我在安装psycopg2时遇到问题.我尝试以下时出现以下错误pip install 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'.
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/psycopg2
Run Code Online (Sandbox Code Playgroud)
但问题pg_config实际上是在我的PATH; 它运行没有任何问题:
$ which pg_config
/usr/pgsql-9.1/bin/pg_config
Run Code Online (Sandbox Code Playgroud)
我尝试将pg_config路径添加到该setup.cfg文件并使用我从其网站(http://initd.org/psycopg/)下载的源文件构建它,我收到以下错误消息!
Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'
Run Code Online (Sandbox Code Playgroud)
但实际上它就是!!!
我对这些错误感到困惑.有人可以帮忙吗?
顺便说一句,我 …
我在我的旧笔记本电脑上设置了一个项目,并在本地安装了 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?