python pip install psycopg2 install error

2019-01-06 14:36发布

I did a simple pip install psycopg2 on mac system. It installed fine, but when I try to use psycopg2 I get the error:

Reason: Incompatible library version: _psycopg.so requires version 1.0.0 or later, but libssl.0.9.8.dylib provides version 0.9.8

pip freeze shows psycopg2==2.4.5 just right. I have installed psycopg2 on several virtualenvs but this is the first time I am seeing such error. I tried uninstalling and reinstalling, same results. Please help

8条回答
该账号已被封号
2楼-- · 2019-01-06 15:25

If you are uncomfortable copying libraries into your system directory, you can use the DYLD_LIBRARY_PATH environment variable to force the OS to search Postgres's library directory for libssl. E.g.:

$ DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.4/lib pip install psycopg2

(documented under the dyld man page).

查看更多
狗以群分
3楼-- · 2019-01-06 15:27

For me on Mavericks, it worked to just copy the two dylib and relaunch Python:

cp /Library/PostgreSQL/9.3/lib/libssl.1.0.0.dylib /usr/lib/
cp /Library/PostgreSQL/9.3/lib/libcrypto.1.0.0.dylib /usr/lib/
查看更多
登录 后发表回答