I did a simple pip install psycopg2 on mac system. It installed fine, but when I try to use psycopg2 I get the error:
pip install psycopg2
Reason: Incompatible libra
Worked for me:
env LDFLAGS='-L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib' pip install psycopg2
Source: https://code-examples.net/en/q/93ae48