在 virtualenv 中安装 psycopg2(Ubuntu 10.04,Python 2.5)

发布于 2024-09-25 16:57:32 字数 1649 浏览 7 评论 0原文

我在 virtualenv 中安装 psycopg2 时遇到问题。

我尝试了那里解释的不同事情: http://www .saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/

我尝试的最后一件事是......
我使用 -p python2.5 --no-site-packages
创建了一个 virtualenv 我安装了 libpq-dev: apt-get install libpq-dev

在 vi​​rtualenv 中,我这样做了: 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:

有人知道如何解决这个问题吗?
谢谢。

I had problems installing psycopg2 in a virtualenv.

I tried different things explained there: http://www.saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/

The last thing I tried is this...
I created a virtualenv with -p python2.5 --no-site-packages
I installed libpq-dev: apt-get install libpq-dev

In the virtualenv, I did this: easy_install -i http://downloads.egenix.com/python/index/ucs4/ egenix-mx-base

Then when I tried pip install psycopg2==2.0.7, I got this error:

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:

Does anyone have any idea how to solve that?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

匿名。 2024-10-02 16:57:32

来自 python 列表:

迪兹:
安装 python-dev-package。它
包含 Python.h 文件,其中
上面的错误信息很清楚
说。通常,这是一个好主意
搜索包描述
debian/ubuntu 软件包丢失
头文件来知道要安装什么。

<块引用>

帕斯卡:
已经安装好了;至少对于
Python 2.6,不确定它是否正确
Python 2.5。 python2.5-dev 不可用,但是
python-old-doctools 似乎取代了它。

<块引用>

迪兹:
100%正确
python2.5。正如错误消息所示
- 它不见了。
如果某处不可用,您可以
应该考虑构建 python
如果您必须使用 2.5,请自行决定。

亚历克斯:
Ubuntu 10.04 没有完整的
Python 2.5 已打包,如下所示
缺少python2.5-dev。你需要
使用Python 2.6或者如果你绝对
必须使用 Python 2.5 构建它
源,尝试 Debian 软件包或切换
发行版。 python-old-doctools 没有
替换掉python-dev,看起来就这样了
不得不保留一些乳胶工具
工作。

<块引用>

Pascal:我终于创建了一个 virtualenv
使用Python 2.6,一切都很顺利
(使用最新版本的 psycopg2)。



From python-list:

Diez:
Install the python-dev-package. It
contains the Python.h file, which the
above error message pretty clearly
says. Usually, it's a good idea to
search package descriptions of
debian/ubuntu packages for missing
header files to know what to install.

Pascal:
It's already installed; at least for
Python 2.6, nor sure it's correct for
Python 2.5. python2.5-dev is not available but
python-old-doctools seems to replace it.

Diez:
It is 100% not correct for
python2.5. As the error message shows
- it's missing.
If it's not available somewhere, you
should consider building python
yourself, if you have to use 2.5.

Alex:
Ubuntu 10.04 doesn't have a full
Python 2.5 packaged, as evidenced by
the lack of python2.5-dev. You need to
use Python 2.6 or if you absolutely
must use Python 2.5 build it from
source, try a Debian package or switch
distro. python-old-doctools does not
replace python- dev, it looks like it
was bodged to keep some latex tools
working.

Pascal: I finally created a virtualenv
with Python 2.6 and everything went fine
(with the latest version of psycopg2).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文