Import psycopg2 Library not loaded: libssl.1.0.0.dylib

Gideon picture Gideon · Dec 3, 2014 · Viewed 43.8k times · Source

When I try to run the command:

import psycopg2

I get the error:

ImportError: dlopen(/Users/gwulfs/anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
  Referenced from: /Users/gwulfs/anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so
  Reason: image not found

So far I have tried brew install openssl and have referenced (with no luck):

psycopg2 installation error - Library not loaded: libssl.dylib

http://joshuakehn.com/2013/10/13/Postgresapp-and-psycopg2-on-OS-X.html

Psycopg2 image not found

Answer

X.L. picture X.L. · Jun 9, 2015

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