python - 找不到 pg_config 可执行文件

标签 python pip psycopg2

我在安装 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

但问题是 pg_config 实际上在我的 PATH 中;它运行没有任何问题:

$ which pg_config
/usr/pgsql-9.1/bin/pg_config

我尝试将 pg_config 路径添加到 setup.cfg 文件并使用我从他们的网站 (http://initd.org/psycopg/) 下载的源文件构建它,但我收到以下错误消息!

Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'

但它确实存在!!!

我对这些错误感到困惑。有人可以帮忙吗?

顺便说一句,我 sudo 所有命令。我也在 RHEL 5.5 上。

最佳答案

pg_configpostgresql-devel 中(libpq-dev 在 Debian/Ubuntu 中,libpq-devel 在Centos/Fedora/Cygwin/Babun.)

关于python - 找不到 pg_config 可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59136580/

相关文章:

python - 使用numpy读取和操作Fortran有序数组的最佳实践

python - pip 不会安装我的包的依赖项

python - 使用 psycopg2 为 Postgres 转义 SQL "LIKE"值

python - 在 Python 中使用变量与 PostgreSQL 通信

python - 如何关闭 PostgreSQL 数据库上的空闲连接

python - 在 opencv - numpy - python 中转换颜色时失去抗锯齿

python - 在 Python 中创建 Numpy 数组而不进行迭代

python __setattr__ 的行为类似于 __getattr__

Python 无法为 dlib Ubuntu 构建轮子

Python Import No Module Named 错误