Cannot get psycopg2 to work, but installed correctly. Mac OS
<p>I'm trying to work with psycopg2 natively on Mac. It installs fine, with no errors at least, but when i import it get an error message.</p>

<p>I've seen dozens of threads with similar issues and solutions that vary massively and just seem excessive for such a common module. </p>

<p>can anyone help? </p>

<pre><code>Last login: Wed Oct 12 15:47:24 on console
Gurmokhs-MBP:~ Gurmokh$ pip install psycopg2
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in     /Library/Python/2.7/site-packages
Gurmokhs-MBP:~ Gurmokh$ python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 12:54:16) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import psycopg2
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File     "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-    packages/psycopg2-2.6.2-py2.7-macosx-10.6-intel.egg/psycopg2/__init__.py",     line 50, in &lt;module&gt;
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME,    ROWID
ImportError:     dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site    -packages/psycopg2-2.6.2-py2.7-macosx-10.6-    intel.egg/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
  Referenced from:     /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-    packages/psycopg2-2.6.2-py2.7-macosx-10.6-intel.egg/psycopg2/_psycopg.so
  Reason: image not found
&gt;&gt;&gt; ^D
Gurmokhs-MBP:~ Gurmokh$ 
</code></pre>

<p>I can see some copies floating round from different applications. 
I'm assuming i could copy one of these. The above message tells me what is referencing this file, but they do not tell me where they expect to find it. If i knew where it should go i would try this.</p>

<pre><code>bash-3.2# find . -name "libssl.1.0.0.dylib"
./Library/Application Support/Fitbit Connect/libssl.1.0.0.dylib
./Library/PostgreSQL/9.5/lib/libssl.1.0.0.dylib
./Library/PostgreSQL/9.5/pgAdmin3.app/Contents/Frameworks/libssl.1.0.0.dylib
./Users/Gurmokh/.Trash/Navicat for PostgreSQL.app/Contents/Frameworks/libssl.1.0.0.dylib
</code></pre>

<p>Thanks guys. </p>

<p>@maxymoo I went with your suggestion. I have installed anaconda2. The install updated my path to include /anaconda/bin. </p>

<p>Then using the navigator I installed pyscopg2. Now I am able to use this in the shebang and my scripts execute fine and i'm able to import this module. </p>

<pre><code>Gurmokhs-MBP:rest Gurmokh$ python
Python 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:43:17) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
&gt;&gt;&gt; import psycopg2
if psycopg2.connect("dbname='postgres' user='postgres' host='localhost'"):
...     print "connection made"
... 
connection made
&gt;&gt;&gt; 
</code></pre>

python osx psycopg2