我过去两天一直试图在我的OS X Yosemite机器上安装 psycopg2 。我安装了python,postgreSQL。我尝试使用:
安装psycopg2sudo pip install psycopg2
它已成功安装,但是当我在python shell中导入它时,我得到了这个:
import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/__init__.py",
line 50, in <module> from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so, 2):
Symbol not found: _lo_lseek64
Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so
Expected in: /usr/lib/libpq.5.dylib
in /Library/Frameworks/Python.frame
我查看了与此相关的所有Stack Overflow问题。什么都行不通! 我也尝试过mac端口,但得到了类似的结果。
更新: 我做了this所说的。现在我明白了:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so
Reason: image not found