Can't install psycopg2 package through pip install... Is this because of Sierra?

I fixed this by installing Command Line Tools

xcode-select --install

then installing openssl via Homebrew and manually linking my homebrew-installed openssl to pip:

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2

on macOS Sierra 10.12.1


Try installing it with:

pip install psycopg2-binary

brew install postgresql

If postgresql exist then run:

brew upgrade postgresql
sudo pip install psycopg2

In venv:

env LDFLAGS='-L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib' pip install psycopg2==2.8.4

If you need use only the command pip install psycopg2 export the path in macOSX:

export LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib"