psycopg: Python.h: No such file or directory

if you take a look at PostgreSQL's faq page ( http://initd.org/psycopg/docs/faq.html ) you'll see that they recommend installing pythons development package, which is usually called python-dev. You can install via

sudo apt-get install python-dev


Python 2:

sudo apt-get install python-dev

Python 3:

sudo apt-get install python3-dev

This is a dependency issue.

I resolved this issue on Ubuntu using apt-get. Substitute it with a package manager appropriate to your system.

For any current Python version:

sudo apt-get install python-dev

For alternative Python version:

sudo apt-get install python<version>-dev

For example 3.5 as alternative:

sudo apt-get install python3.5-dev