我在 virtualenv 中安装 psycopg2 时遇到问题。
我尝试了不同的东西在那里解释:http: //www.saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/
我尝试的最后一件事是……
我创建了一个-p python2.5 --no-site-packages
安装了 libpq-dev 的 virtualenv:apt-get install libpq-dev
在 virtualenv 中,我这样做了:easy_install -i http://downloads.egenix.com/python/index/ucs4/ egenix-mx-base
然后当我尝试时pip install psycopg2==2.0.7
,我得到了这个错误:
Installing collected packages: psycopg2
Running setup.py install for psycopg2
building 'psycopg2._psycopg' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.2.2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/usr/include/python2.5 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/psycopgmodule.c -o build/temp.linux-i686-2.5/psycopg/psycopgmodule.o -Wdeclaration-after-statement
psycopg/psycopgmodule.c:27:20: error: Python.h: No such file or directory
In file included from psycopg/psycopgmodule.c:31:
./psycopg/python.h:31:26: error: structmember.h: No such file or directory
./psycopg/python.h:34:4: error: #error "psycopg requires Python >= 2.4"
In file included from psycopg/psycopgmodule.c:32:
有谁知道如何解决这个问题?
谢谢。