导入psycopg2

时间:2015-07-10 08:08:40

标签: postgresql python-3.x amazon-redshift

我正在尝试导入pscycopg2。我在运行import psycopg2时遇到滚动错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 50, in <module> from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
  ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so,' 2): Symbol not found: _lo_lseek64
  Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
  Expected in: /usr/lib/libpq.5.dylib in /Library/Python/2.7/site-packages/psycopg2/_psycopg.so

我被困在了。请帮忙。

1 个答案:

答案 0 :(得分:2)

您的std::string是针对较新的PostgreSQL psycopg2编译的,而不是您的OS X系统在运行时加载的版本。您可能安装了多个版本的PostgreSQL。

检查您的libpq并确保最新的PostgreSQL DYLD_LIBRARY_PATH位于路径的第一位。