0
我正在运行Mac OSX。直到今天,我的Python 2.6与psycopg2运行得很好,我用它与Django和Pylons。我刚刚reintalled Postgres的(我不知道这是否已连接),突然我无法导入psycopg2成Python没有一个奇怪的错误:Python错误 - psycopg2:没有合适的64位体系结构?
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.6-universal/egg/psycopg2/__init__.py", line 69, in <module>
File "build/bdist.macosx-10.6-universal/egg/psycopg2/_psycopg.py", line 7, in <module>
File "build/bdist.macosx-10.6-universal/egg/psycopg2/_psycopg.py", line 6, in __bootstrap__
ImportError: /usr/lib/libpq.5.dylib: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)
与Python 2.5试图给出一个类似的错误:
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/lib/python2.5/site-packages/psycopg2/__init__.py", line 69, in <module>
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: /opt/local/lib/postgresql84/libpq.5.dylib
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/psycopg2/_psycopg.so
Reason: no suitable image found. Did find:
/usr/lib/libpq.5.dylib: no matching architecture in universal wrapper
我不知道这是什么意思,它来自哪里,或者如何处理它。请任何人都可以帮忙?
不是 - 从一开始就一直使用雪豹... – AP257 2010-08-01 19:18:08
你是如何安装postgres的?你有没有检查过它产生了一个通用的二进制文件,或者是一个特定的架构(看起来像x86)。我猜想/opt/local/lib/postgresql84/libpq.5.dylib是要检查的文件。如果这是你的问题,那么以32位模式运行python(检查联机帮助页)或看看http://www.kyngchaos.com/software:postgres – Amoss 2010-08-02 08:22:04
卸载psycopg2(使用easy_install -m,然后删除。鸡蛋),并重新安装它解决了这个问题。我会接受你的答案 - 谢谢你的帮助。 – AP257 2010-08-02 10:39:14