Import psycopg2 Library not loaded: libssl.1.0.0.dylib Import psycopg2 Library not loaded: libssl.1.0.0.dylib postgresql postgresql

Import psycopg2 Library not loaded: libssl.1.0.0.dylib


Instead of playing with symlinks in system library dirs, set the $DYLD_FALLBACK_LIBRARY_PATH to include the anaconda libraries. eg:

export DYLD_FALLBACK_LIBRARY_PATH=$HOME/anaconda/lib/:$DYLD_FALLBACK_LIBRARY_PATH


After Homebrew wouldn't allow me to force link openssl the following worked fine:

pip install --global-option=build_ext \            --global-option="-I/usr/local/opt/openssl/include" \            --global-option="-L/usr/local/opt/openssl/lib" psycopg2

(this installation succeeded in a virtualenv on macOS)


EDIT: potentially dangerous, read comments first!

See a much safer answer below: https://stackoverflow.com/a/30726895/308315


I ran into this exact issue about an hour after you posted it and just figured it out. I am using Mac OS X Yosemite, Python 2.7, and the Postgresql app.

There seems to be a non-working symlink set by default (or I introduced it while troubleshooting), to fix it first remove the incorrect links:

$ sudo rm /usr/lib/libssl.1.0.0.dylib$ sudo rm /usr/lib/libcrypto.1.0.0.dylib

Then re-link them with (replace YOURUSERNAME with your Mac user name. I found it helpful to use tab to complete each step, to confirm the directory):

$ sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libssl.1.0.0.dylib /usr/lib$ sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libcrypto.1.0.0.dylib /usr/lib

I believe the other solutions didn't work for you because your version is in anaconda.