Problems using psycopg2 on Mac OS (Yosemite)
If you are using PostgresApp, you need to run the following two commands:
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
I was able to fix this on my Mac (running Catalina, 10.15.3) by using psycopg2-binary rather than psycopg2.
pip3 uninstall psycopg2
pip3 install psycopg2-binary
You need to replace the /usr/lib/libpq.5.dylib library because its version is too old.
Here's my solution to this problem:
$ sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old
$ sudo ln -s /Library/PostgreSQL/9.4/lib/libpq.5.dylib /usr/lib