$ yum install python3 postgresql python-devel libpqxx-devel
Loaded plugins: langpacks, refresh-packagekit
Package python3-3.3.2-8.fc20.x86_64 already installed and l
Install the python3-devel package to get it work
sudo dnf install python3-devel
If it works then alright or if it requires libpq-fe.h file then install it using the command:
sudo dnf install postgresql-devel
On Ubuntu. I solved this with:
sudo apt-get install libpq-dev
You are missing python3 include files
./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory
you can probably find them in the python3-devel
package.
As indicated in the other answers this is caused by not having the right Python "devel" package installed. On CentOS, the Python "devel" rpm package is numbered with the with the qualified version. For example as of this writing the current versions are:
python34-devel
for epel repository
python36u-devel
for ius repository
Example Yum command (assumes EPEL repository is configured):
sudo yum install python34-devel
Related answer from server fault: https://serverfault.com/questions/710354/repository-for-python3-devel-on-centos-7