在cygwin中安装psycopg2时出错

2024-05-23 08:11:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在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

在那之后,我试图得到d pg_配置文件,但在网上找不到。在


Tags: installtheorgconfighttpeasysetuptar
2条回答

pg_config是PostgreSQL安装的一部分。它位于本地安装的bin目录中(例如C:\Program Files(x86)\PostgreSQL\9.0\bin)。将该目录添加到您的搜索路径并尝试重新生成。在

我今天刚刚成功地安装了psycopg2,而没有安装windows PostgreSQL(在我的例子中,db已经在另一台服务器上设置好了,我只需要使用依赖于psycopg2的python包连接到它,所以完成安装对我来说是不必要的)。在

pg_config executable not found之后,我从cygwin安装程序安装了postgresql-devellibpq dev(这些应该是必要的,据记录,我还安装了许多其他与postgresql相关的包,如postgresql client、postgresql plpython和libpq5)。在

在那之后,我可以成功地运行pip install psycopg2

相关问题 更多 >

    热门问题