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

发布于 2024-09-12 17:51:43 字数 1526 浏览 5 评论 0原文

我正在运行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左岸枫 2024-09-19 17:51:43

您是否刚刚升级到 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文