SOLVED: Error: pg_config executable not found.


Installing a python dependency that uses postgresql usually returns an erorr like:

Processing psycopg2-2.7.1.tar.gz
Writing /tmp/easy_install-2McIYa/psycopg2-2.7.1/setup.cfg
Running psycopg2-2.7.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-2McIYa/psycopg2-2.7.1/egg-dist-tmp-_jvZBd
Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.
error: Setup script exited with 1

Fixing this issue is really easy, we need just to install:

For ubuntu:

sudo apt-get install libpq-dev

For fedora:

sudo apt-get install postgresql-devel