我正在运行 Mac OSX。直到今天,我的 Python 2.6 和 psycopg2 都运行得很好,我将它与 Django 和 Pylons 一起使用。我刚刚重新安装了 postgres(我不知道这是否已连接),突然间我无法将 psycopg2 导入 Python 而不出现奇怪的错误:
>>> 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
我不知道这意味着什么,它来自哪里,或者该怎么做。请问有人可以帮忙吗?