Psycopg2 fails to install on python 3 with pip issuing a fatal error

时光总嘲笑我的痴心妄想 提交于 2019-11-29 11:08:15

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.

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
Mark Edington

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!