Install psycopg2 (PostgreSQL adapter for Python) on OSX
By Rayed
I was playing with Django with Postgres backend, and I had little difficulty installing “psycopg2” the Python DB adapter for Postgres on my Mac OSX.
I’ve installed Postgres using Postgres.app for OSX which is straight forward and standard Mac app.
But when I tried installing “psycopg2” using “pip” (the python package manager) I got an error:
$ pip install psycopg2
:
Error: pg_config executable not found.
:
I just searched for “pg_config” in my system:
$ find / -name pg_config 2>/dev/null
/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Then added to my PATH env and pip worked:
$ export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin/
$ pip install psycopg2