Background / Context
Packages and dependencies are installed with Homebrew.
Error
Homebrew openssl
not linked to Python pip
Fix / Solution
Ensure that x-code Command Line Tool is installed:
$ xcode-select --install
Update Homebrew and its packages:
$ brew updates
$ brew upgrade
Install psycopg2
with below command:
$ env LDFLAGS=`$(pg_config --ldflags)` pip install psycopg2==2.8.3