I'm catching up with Python + Postgre and Psycopg2.
I installed Python 3.4 on my MAC, then Postgre, and then followed the following steps:
export PATH=/Library/PostgreSQL/9.4/bin:$PATH
pip install psycopg2
He installed Psycopg 2, but when I give an import I get the following error:
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /Users/leandro/PycharmProjects/Teste/teste.py
Traceback (most recent call last):
File "/Users/leandro/PycharmProjects/Teste/teste.py", line 1, in <module>
import psycopg2
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so
Reason: image not found
Process finished with exit code 1
On the web I found references to do the following:
sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old
sudo ln -s /Applications/Postgres.app/Contents/Versions/9.4/lib/libpq.5.dylib /usr/lib
or
sudo ln -s /Library/PostgreSQL/9.4/lib/libpq.5.dylib /usr/lib
But did not solve ... Any tips?