2015-07-10 81 views
1

我正在嘗試導入pscycopg2。我在運行時遇到滾動錯誤import psycopg2導入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 

我被困在它。請幫忙。

回答

2

您的psycopg2是針對較新的PostgreSQL libpq編譯的,而不是您的OS X系統在運行時加載的。您可能安裝了多個PostgreSQL版本。

檢查您的DYLD_LIBRARY_PATH並確保最新的PostgreSQL libpq.5.dylib在路徑上第一個。

相關問題