Python – Unable to load psycopg2

Well this was very frustrating to fix “Unable to load psycopg2” but I wanted to share my findings with everyone so they will not go through the ordeal that I did.

I installed a new version of python to my work station, updated my python code to support that new version of python. After executing the python script I received the following error message “Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib”. After much searching I found several sites that helped me figure out the issue. So what I figured out is that if I linked the files from /usr/local/lib you don’t get that error message.

You might have to edit the below command line items to your paths but this should give you a pretty good idea on what to do

cd /usr/local/lib
sudo ln -s /Library/PostgreSQL/9.6/lib/libssl.1.0.0.dylib
sudo ln -s /Library/PostgreSQL/9.6/lib/libcrypto.1.0.0.dylib
sudo ln -s /Library/PostgreSQL/9.6/lib/libpq.5.dylib