Python错误 - psycopg2:没有合适的64位架构?

时间:2010-08-01 18:44:44

标签: python postgresql psycopg2

我正在运行Mac OSX。直到今天我使用psycopg2的Python 2.6运行得很好,我正在使用它与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

我不知道这意味着什么,它来自哪里,或者该怎么做。请任何人帮忙吗?

1 个答案:

答案 0 :(得分:0)

你刚刚升级到Snow Leopard吗? Leopard版本的Python是32位,而64位是Snow Leopard。它破坏了一些使用64位模式下不可用的本机代码的库。