相关疑难解决方法(0)

在cygwin中安装psycopg2时出错

我正在尝试在cygwin中安装psycopg2但还没有成功.错误是: -

Gaurav@gauravpc ~/FieldAgentWeb/FieldAgentWeb
$ easy_install psycopg2
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.2
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.2.tar.gz
Processing psycopg2-2.4.2.tar.gz
Running psycopg2-2.4.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QBYpxH
/psycopg2-2.4.2/egg-dist-tmp-gcLa5F
Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.
error: Directory not empty <built-in function rmdir> /tmp/easy_install-QBYpxH/ps
ycopg2-2.4.2/tests
Run Code Online (Sandbox Code Playgroud)

之后,我试图获得d pg_config文件,但无法在网上找到它.

python django

6
推荐指数
2
解决办法
2787
查看次数

Heroku 上的 Python 入门 - 找不到 pg_config 可执行文件

我一直在关注文档,直到我安装了 requirements.txt 文件。尝试安装第 6 行“psycopg2==2.5.3”时总是失败。这是消息——

Downloading/unpacking psycopg2==2.5.3 (from -r requirements.txt (line 6))
Downloading psycopg2-2.5.3.tar.gz (690kB): 690kB downloaded
Running setup.py (path:/Users/pimpc/Sites/python/herokudemo/python-getting-started/venv/build/psycopg2/setup.py) egg_info for package psycopg2

Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.
Complete output from command python setup.py egg_info:
running egg_info

creating pip-egg-info/psycopg2.egg-info

writing pip-egg-info/psycopg2.egg-info/PKG-INFO

writing top-level names to
pip-egg-info/psycopg2.egg-info/top_level.txt

writing …
Run Code Online (Sandbox Code Playgroud)

python postgresql heroku

5
推荐指数
1
解决办法
1609
查看次数

pip install psycopg2==2.6 给出错误命令“python setup.py Egg_info”失败,错误代码 1 in /tmp/pip-build-f6rRmm/psycopg2/

我的项目正在运行 postgreSQL,在我将系统升级到 ubuntu 16.04 并再次克隆该项目后,我无法安装特定的包。

我也尝试清除 postgresql 和 psycopg2 但无法安装它

(temp) hellrazor@hellrazor-desktop:~/workspace/te___ave/backend/te___ave$ pip install psycopg2==2.6 > ERROR.txt
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-f6rRmm/psycopg2/
(temp) hellrazor@hellrazor-desktop:~/workspace/te___ave/backend/te___ave$ 
Run Code Online (Sandbox Code Playgroud)

这是我收到的错误

Collecting psycopg2==2.6
  Using cached psycopg2-2.6.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    Error: pg_config executable not found.

    Please add the directory containing pg_config to the PATH
    or specify the full …
Run Code Online (Sandbox Code Playgroud)

installation pip psycopg2 python-2.7 postgresql-9.1

5
推荐指数
1
解决办法
1万
查看次数

当我尝试使用 pip install psycopg2 安装 psycopg2 时,出现此错误。我应该怎么办?

''' pip install psycopg2 使用缓存的 psycopg2-2.8.5.tar.gz (380 kB) 收集 psycopg2 错误:命令错误,退出状态 1:命令:/opt/anaconda3/bin/python -c 'import sys, setuptools ,标记化;sys.argv[0] = '"'"'/private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80000gn/T/pip-install-d7jzvy68/psycopg2/setup.py'"'"'; 文件='"'"'/private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80000gn/T/pip-install-d7jzvy68/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open' "'"', open)(文件);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"'); f.close();exec(编译(代码,文件,'"'"'exec'"'"'))'egg_info --egg-base /private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80000gn/T/pip-pip -egg-info-6sv6r8te cwd:/private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80000gn/T/pip-install-d7jzvy68/psycopg2/完整输出(23行):运行egg_info创建/private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80 000克/ T/pip-pip-egg-info-6sv6r8te/psycopg2.egg-info 写入 /private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80000gn/T/pip-pip-egg-info-6sv6r8te/psycopg2.egg-info/PKG-INFO将 dependency_links 写入 /private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80000gn/T/pip-pip-egg-info-6sv6r8te/psycopg2.egg-info/dependency_links.txt 将顶级名称写入 /private/var/folders/v8/ vk9679rj7m7f03_0hztz3rc80000gn/T/pip-pip-egg-info-6sv6r8te/psycopg2.egg-info/top_level.txt 写入清单文件 '/private/var/folders/v8/vk9679rj7m7f03_0hztz3rc80000gn/T/pip-pip-egg-info-6 sv6r8te/ psycopg2.egg-info/SOURCES.txt'

Error: pg_config executable not found.

pg_config is required to build psycopg2 from source.  Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:

    python …
Run Code Online (Sandbox Code Playgroud)

python psycopg2 flask-sqlalchemy

4
推荐指数
1
解决办法
1万
查看次数

Poetry python:如何使用从 Docker 运行的 Postgres 安装 Psycopg2

我在我的旧笔记本电脑上设置了一个项目,并在本地安装了 Postgresql,并使用 Poetry 作为包管理器。现在我搬到另一台笔记本电脑上。在这一项上,我想使用 Docker 中的 Postgres,所以我没有安装它。但是当我运行poetry install从文件设置项目时poetry.lock,它无法安装 Psycopg2 并出现错误:

Error: pg_config executable not found.
Run Code Online (Sandbox Code Playgroud)

据我搜索,它需要在本地安装 Postgres。那么,如何使用 Docker 中的 Postgres 从锁定文件安装 Psycopg2?

python postgresql psycopg2 docker python-poetry

4
推荐指数
1
解决办法
1万
查看次数

pip 无法使用 python 3.10 在 ubuntu 22.04 上安装 psycopg2-binary

在 Ubuntu 22.04 上看到这个,它有 python 3.10

\n
pip3 install psycopg2-binary==2.8.5                                                                                                                                                            \nDefaulting to user installation because normal site-packages is not writeable                                                                                                                                          \nCollecting psycopg2-binary==2.8.5                                                                                                                                                                                      \n  Using cached psycopg2-binary-2.8.5.tar.gz (381 kB)                                                                                                                                                                   \n  Preparing metadata (setup.py) ... error                                                                                                                                                                              \n  error: subprocess-exited-with-error                                                                                                                                                                                  \n                                                                                                                                                                                                                       \n  \xc3\x97 python setup.py egg_info did not run successfully.                                                                                                                                                                 \n  \xe2\x94\x82 exit code: 1                                                                                                                                                                                                       \n  \xe2\x95\xb0\xe2\x94\x80> [23 lines of output]                                                                                                                                                                                             \n      running egg_info                                                                                                                                                                                                 \n      creating /tmp/pip-pip-egg-info-qc0tg_5p/psycopg2_binary.egg-info                                                                                                                                                 \n      writing /tmp/pip-pip-egg-info-qc0tg_5p/psycopg2_binary.egg-info/PKG-INFO                                                                                                                                         \n      writing dependency_links to /tmp/pip-pip-egg-info-qc0tg_5p/psycopg2_binary.egg-info/dependency_links.txt                                                                                                         \n      writing top-level names to /tmp/pip-pip-egg-info-qc0tg_5p/psycopg2_binary.egg-info/top_level.txt                                                                                                                 \n      writing …
Run Code Online (Sandbox Code Playgroud)

python psycopg2

3
推荐指数
1
解决办法
5678
查看次数

在 macOS 上安装 psycopg2 失败

我已经PostgreSQL在 macOS 上通过 brew安装了:

brew install postgresql
Run Code Online (Sandbox Code Playgroud)

尝试了这些命令,都失败了:

  • pipenv 安装 psycopg2
  • pip 安装 psycopg2

错误:

brew install postgresql
Run Code Online (Sandbox Code Playgroud)

此外,将其设置为 shell 然后重新加载:

...
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -DPSYCOPG_VERSION=2.8.4 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120001 -DHAVE_LO64=1 -I/Users/user0/.pyenv/versions/3.8.0/include/python3.8 -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/adapter_qstring.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_qstring.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -DPSYCOPG_VERSION=2.8.4 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120001 -DHAVE_LO64=1 -I/Users/user0/.pyenv/versions/3.8.0/include/python3.8 -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/microprotocols.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/microprotocols.o
  clang -Wno-unused-result …
Run Code Online (Sandbox Code Playgroud)

python macos pip psycopg2 pipenv

2
推荐指数
2
解决办法
1643
查看次数