Psycopg2 Python SSL Support is not compiled in

前端 未结 7 1956
梦毁少年i
梦毁少年i 2020-12-16 13:38

I am trying to connect to my postgres database using psycopg2 with sslmode=\'required\' param; however, I get the following error

psycopg2.OperationalError:          


        
7条回答
  •  我在风中等你
    2020-12-16 13:54

    I had this same error, which turned out to be because I was using the Anaconda version of psycopg2. To fix it, I had adapt VictorF's solution from here and run:

    conda uninstall psycopg2
    sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libssl.1.0.0.dylib /usr/local/lib
    sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libcrypto.1.0.0.dylib /usr/local/lib
    pip install psycopg2
    

    Then when you run conda list you'll see psycopg2 installed with in the far right column. After that, I just restarted Python and everything worked.

提交回复
热议问题