I am trying to compile a Python extension written in C on a CentOS machine. I am getting
error: Python.h: No such file or directory
It works fine on ubuntu, where I have python-dev installed using apt-get.
I tried installing python-devel using
yum install python-devel
but it is already installed. How do I fix this error?
On my system the
Python.hheader 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-Ioption to the compiler, like this:Change the path above to the actual path on your system. You can find it either with the
findcommand as proposed in a comment, of with thelocatecommand if it’s installed.