Estou apanhando com o Python + Postgre e Psycopg2.
Instalei o Python 3.4 no meu MAC, depois o Postgre e em seguida segui os seguintes passos:
export PATH=/Library/PostgreSQL/9.4/bin:$PATH
pip install psycopg2
Ele instalou o Psycopg 2, porém quando dou um import eu recebo o seguinte erro:
/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
Na web eu achei referencias para fazer o seguinte:
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
ou
sudo ln -s /Library/PostgreSQL/9.4/lib/libpq.5.dylib /usr/lib
Porém não resolveu … Alguma dica?