Can't find Python.h file on CentOS

If you using python3 You could install python34-devel for that

It's available on EPEL Repository and has python34-devel package available

You simply just run this command to get it installed

yum install python34-devel

Hope it's help

*note At this time python34-devel is the most updated version of python 3.4


On my system the Python.h header file is in the path /usr/include/python2.6/. As this path is not searched by the pre-processor by default, you have to add it to the list of paths to search. This is done with the -I option to the compiler, like this:

$ gcc -I/usr/include/python2.6 source.c -o program

Change the path above to the actual path on your system. You can find it either with the find command as proposed in a comment, of with the locate command if it's installed.


  • for CentOS 7.4
    • Python 3.6.6 : yum -y install python36-devel
    • Python 2 : yum -y install python-devel
  • for Ubuntu
    • Python 3.6: apt-get install libpython3.6-dev

Tags:

Python

C

Centos