我试图在Rodeo中导入psycopg2库但是收到错误。
错误:
ImportErrorTraceback (most recent call last)
<ipython-input-7-bd284aa2cf56> in <module>()
----> 1 import psycopg2
/Users/chrisstroud/anaconda/lib/python3.5/site-packages/psycopg2-2.6.2-py3.5-macosx-10.6-x86_64.egg/psycopg2/__init__.py in <module>()
48 # Import the DBAPI-2.0 stuff into top-level module.
49
---> 50 from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
51
52 from psycopg2._psycopg import Binary, Date, Time, Timestamp
ImportError: dlopen(/Users/chrisstroud/anaconda/lib/python3.5/site-packages/psycopg2-2.6.2-py3.5-macosx-10.6-x86_64.egg/psycopg2/_psycopg.cpython-35m-darwin.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Users/chrisstroud/anaconda/lib/python3.5/site-packages/psycopg2-2.6.2-py3.5-macosx-10.6-x86_64.egg/psycopg2/_psycopg.cpython-35m-darwin.so
Reason: image not found
答案 0 :(得分:0)
首先,您必须使用 pip 安装psycopg2:
pip安装psycopg2
如果您使用的是Linux或Mac,则必须使用 sudo 授予root权限。
之后,只需使用以下命令导入库即可:
导入“ psycopg2”
如果它不起作用,则应将库文件夹放入项目文件夹中。