为什么我不能安装psycopg2? (Python 2.6.4,PostgreSQL 8.4,OS X 10.6.3)

编程入门 行业动态 更新时间:2024-10-25 14:24:17
本文介绍了为什么我不能安装psycopg2? (Python 2.6.4,PostgreSQL 8.4,OS X 10.6.3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

原始消息(现已过时):

运行python setup.py install之后,我得到以下信息:

After running python setup.py install I get the following:

Warning: Unable to find 'pg_config' filebuilding 'psycopg2._psycopg' extension gcc-4.0 -arch ppc -arch i386 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 - DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.2.1 (dt dec ext pq3)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I. -c psycopg/psycopgmodule.c -o build/temp.macosx-10.3-fat-2.6/psycopg/psycopgmodule.o unable to execute gcc-4.0: No such file or directory error: command 'gcc-4.0' failed with exit status 1

对于知道第一个问题的人来说,那里似乎有些尖叫关于后端Web编程的事情,但不幸的是,这全都是我的事。 psycopg2文档没有帮助。

There's probably something screamingly obvious there to anyone who knows the first thing about back-end web programming, but unfortunately it's all gobbledegook to me. The psycopg2 documentation was not helpful.

6月12日初更新:更新了我所有的软件之后,错误消息已更改。

UPDATE early 12 June: After updating all my software, the error message has changed.

现在,当我运行 python setup.py install时,我得到以下信息:

Now, when I run "python setup.py install" I get the following:

Warning: Unable to find 'pg_config' filebuilding 'psycopg2._psycopg' extension gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.2.1 (dt dec ext pq3)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I. -c psycopg/psycopgmodule.c -o build/temp.macosx-10.3-fat-2.6/psycopg/psycopgmodule.o

之后是很长的其他错误消息列表。

followed by a very long list of other error messages.

当我在终端中输入 gcc-4.0时,可能会或可能无关紧要。它会返回:

It may or may not be relevant that when I put "gcc-4.0" into Terminal, it comes back with:

i686-apple-darwin10-gcc-4.0.1: no input files

UPDATE 12:41 GMT 12月12日: I认为macports安装已经成功,但是当我尝试运行站点时,它以以下错误结束:

UPDATE 12:41 GMT 12 June: I thought the macports installation had worked, but when I tried running a site it ended with the following error:

raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2

$的模块b $ b

所以我想这意味着psycopg2毕竟没有正确安装。因此,我回到正题。

So I guess that means that psycopg2 hadn't installed properly after all. So I'm back to square one.

推荐答案

我认为您正在变得比原本要难。与其直接运行setup.py,不建议让MacPorts为您做这件事:

I think you're making it harder than it has to be. Rather than running setup.py directly, I suggest letting MacPorts do it for you:

sudo port install py26-psycopg2

更多推荐

为什么我不能安装psycopg2? (Python 2.6.4,PostgreSQL 8.4,OS X 10.6.3)

本文发布于:2023-10-18 12:16:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504203.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Python   PostgreSQL   OS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!