title: Import psycopg2
body: <p>I am stuck trying to import psycopg2. I am working in MacOSX10.10.1 and have downloaded the one-click version of Postgresql (<a href="http://www.enterprisedb.com/products-services-training/pgdownload" rel="nofollow">http://www.enterprisedb.com/products-services-training/pgdownload</a>). When I try to import psycopg2 I get this error message:</p>
  
  <pre><code>ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
  Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
  Reason: image not found 
  </code></pre>
  
  <p>I have already try this:</p>
  
  <pre><code>rm /usr/lib/libcrypto.1.0.0.dylib 
  sudo ln -s /Library/PostgreSQL/9.4/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.1.0.0.dylib
  </code></pre>
  
  <p>For each of libssl.1.0.0.dylib, libcrypto.1.0.0.dylib and libpq.5.dylib.</p>
  
  <p>Also try to set my environment doing this:</p>
  
  <pre><code>export DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.4/lib
  </code></pre>
  
  <p>And in the python code:</p>
  
  <pre><code>import os
  os.environ['DYLD_LIBRARY_PATH'] = '/Library/PostgreSQL/9.4/lib'
  </code></pre>
  
  <p>Still getting the same error.</p>
  
  <p>If I look for:</p>
  
  <pre><code>locate libpq.5
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libpq.5.5.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libpq.5.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libpq.5.5.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libpq.5.dylib
  /Library/PostgreSQL/9.4/lib/libpq.5.7.dylib
  /Library/PostgreSQL/9.4/lib/libpq.5.dylib
  /Library/PostgreSQL/9.4/pgAdmin3.app/Contents/Frameworks/libpq.5.7.dylib
  /Library/PostgreSQL/9.4/pgAdmin3.app/Contents/Frameworks/libpq.5.dylib
  /sw/opt/postgresql-9.2/lib/libpq.5.5.dylib
  /sw/opt/postgresql-9.2/lib/libpq.5.dylib
  /usr/lib/libpq.5.5.dylib
  /usr/lib/libpq.5.dylib
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>    locate libcrypto
  /Applications/Adobe Stock Photos CS3/Adobe Stock Photos CS3.app/Contents/Libraries/libcrypto.dylib
  /Applications/MEGA6.06-mac.app/Contents/Frameworks/libcrypto.1.0.0.dylib
  /Applications/MEGA6.06-mac.app/Contents/Frameworks/libcrypto.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libcrypto.0.9.7.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libcrypto.0.9.8.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libcrypto.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libcrypto.0.9.7.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libcrypto.0.9.8.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libcrypto.dylib
  /Library/OpenSC/lib/libcrypto.0.9.8.dylib
  /Library/OpenSC/lib/libcrypto.a
  /Library/OpenSC/lib/libcrypto.dylib
  /Library/OpenSC/lib/pkgconfig/libcrypto.pc
  /Library/PostgreSQL/9.4/lib/libcrypto.1.0.0.dylib
  /Library/PostgreSQL/9.4/lib/libcrypto.dylib
  /Library/PostgreSQL/9.4/pgAdmin3.app/Contents/Frameworks/libcrypto.1.0.0.dylib
  /sw/lib/libcrypto.1.0.0.dylib
  /usr/lib/libcrypto.0.9.7.dylib
  /usr/lib/libcrypto.0.9.8.dylib
  /usr/lib/libcrypto.1.0.0.dylib
  /usr/lib/libcrypto.dylib
  /usr/lib/pkgconfig/libcrypto.pc
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>locate libssl
  /Applications/Adobe Stock Photos CS3/Adobe Stock Photos CS3.app/Contents/Libraries/libssl.dylib
  /Applications/MEGA6.06-mac.app/Contents/Frameworks/libssl.1.0.0.dylib
  /Applications/MEGA6.06-mac.app/Contents/Frameworks/libssl.dylib
  /Applications/OpenOffice.app/Contents/MacOS/libssl3.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libssl.0.9.7.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libssl.0.9.8.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libssl.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libssl.0.9.7.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libssl.0.9.8.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libssl.dylib
  /Library/OpenSC/lib/libssl.0.9.8.dylib
  /Library/OpenSC/lib/libssl.a
  /Library/OpenSC/lib/libssl.dylib
  /Library/OpenSC/lib/pkgconfig/libssl.pc
  /Library/PostgreSQL/9.4/lib/libssl.1.0.0.dylib
  /Library/PostgreSQL/9.4/lib/libssl.dylib
  /Library/PostgreSQL/9.4/pgAdmin3.app/Contents/Frameworks/libssl.1.0.0.dylib
  /sw/lib/libssl.1.0.0.dylib
  /usr/lib/libssl.0.9.7.dylib
  /usr/lib/libssl.0.9.8.dylib
  /usr/lib/libssl.1.0.0.dylib
  /usr/lib/libssl.dylib
  /usr/lib/pkgconfig/libssl.pc
  </code></pre>
  
  <p>EDIT: I already had Postgresql and psycopg2 imported and working, but Postgresql stopped listening to the server, and I ended up uninstalling and re-installing it again (after trying every single thing proposed in forums). </p>
  
  <p>I am just starting working with python, SQL and even the bash! So this is just to much for me. I really appreciate if anyone has any idea.</p>