Python 错误 - psycopg2:没有合适的 64 位架构?
我正在运行 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
我不知道这意味着什么,在哪里它来自哪里,或者如何处理它。请问有人可以帮忙吗?
I'm running Mac OSX. Until today I had Python 2.6 with psycopg2 running just fine, I was using it with Django and Pylons. I've just reintalled postgres (I don't know if this is connected) and suddenly I can't import psycopg2 into Python without a strange error:
>>> 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)
Trying with Python 2.5 gives a similar error:
>>> 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
I have no idea what this means, where it's come from, or what to do about it. Please can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否刚刚升级到 Snow Leopard? Python 的 Leopard 版本是 32 位,而 Snow Leopard 是 64 位。它破坏了一些使用在 64 位模式下不可用的本机代码的库。
Have you just upgraded to Snow Leopard by any chance? The Leopard version of Python is 32-bit, while the 64-bit is in Snow Leopard. It breaks some libraries that use native code that aren't available in 64-bit mode.