未找到pg_config可执行文件

2022-09-05 01:02:17

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

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

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

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

但它实际上就在那里!!!

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

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


答案 1

pg_configis in ( in Debian/Ubuntu, on Centos/Fedora/Cygwin/Babun.postgresql-devellibpq-devlibpq-devel


答案 2

在Mac OS X上,我使用自制包管理器解决了它

brew install postgresql