Khor Shao Liang

I am a final year student in School of Computing at National University of Singapore. I am pursuing a Bachelor of Computing (Computer Science) specializing in Database Systems.

Installing psycopg2 in Python's virtualenv on macOS

05 Aug 2019 » python, psycopg2, postgresql, virtualenv, pip, homebrew, brew

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