Import psycopg2 Library not loaded: libssl.1.0.0.dylib

前端 未结 20 2492
囚心锁ツ
囚心锁ツ 2020-11-28 21:02

When I try to run the command:

import psycopg2

I get the error:

ImportError: dlopen(/Users/gwulfs/anaconda/lib/python2.7/si         


        
20条回答
  •  清酒与你
    2020-11-28 21:39

    So first for me openssl re-install never worked. It was quite irritating that all of the above answers failed for me. To be sure that it's a openssl issue, first, install psycopg2-binary using pip

      pip install psycopg2-binary
    

    After installing psycopg2-binary, if you're getting error like ld: library not found for -lssl then do the following

      export LDFLAGS="-L/usr/local/opt/openssl/lib"
      export CPPFLAGS="-I/usr/local/opt/openssl/include"
    

    if these didn't work then you can try to upgrade psycopg2 and re-check that issue still there or not.

      pip install psycopg2 --upgrade
    

    if all the above didn't worked then only try reinstalling openssl as mentioned in all above answers.

提交回复
热议问题