安装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_配置路径添加到setup.cfg
文件中,并使用从他们的网站(http://initd.org/psycopg/)下载的源文件构建它,得到以下错误消息!
Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'
但它确实在那里!!!
我对这些错误感到困惑。有人能帮忙吗?
顺便说一下,我sudo
所有的命令。我也在5.5区。
你安装了
python-dev
吗? 如果已经安装了,请尝试同时安装libpq-dev
来自文章:How to install psycopg2 under virtualenv
在Mac OS X上,我使用homebrew包管理器解决了这个问题
pg_config
位于postgresql-devel
(libpq-dev
位于Debian/Ubuntu中,libpq-devel
位于Cygwin/Babun中。)相关问题 更多 >
编程相关推荐