我在更新到Mac OS X Mountain Lion后遇到psycopg2错误,之前它运行正常。 如果我尝试导入模块,这是错误:
Python 2.7.3 (default, Sep 27 2012, 21:57:16)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.65))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/__init__.py", line 67, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _GSS_C_NT_HOSTBASED_SERVICE
Referenced from: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
我用brew来安装python和psycopg2。 任何想法都会有所帮助。
由于 亚历
答案 0 :(得分:1)
尝试酿造postgresql。该错误可能与libpq(PostgreSQL客户端库,其中psycopg是包装器)的链接方式有关。
答案 1 :(得分:0)
混合native和brew应用程序并不是那么好......我宁愿从brew卸载psycopg2和python并安装“命令行工具”,如pip install fails with /usr/bin/clang: No such file or directory中所述。然后重试pip install,它会起作用,至少它为我完成了工作!