Python.h: No such file or directory #include

When trying to compile pyqt i have an error error of the python.h

i have installed all the prerequistes but its still showing the same problem please find an answer for this

2

2 Answers

For Python 2

sudo apt-get install python-dev 

Since Python.h is provided by -dev

For Python 3

sudo apt-get install python3-dev 

the missing header file Python.h is in the python-dev package, first check that you have it installed:

$ dpkg --get-selections |grep python-dev libboost-mpi-python-dev install libboost-python-dev install python-dev install 

You can also use 'locate' to see if the file exists:

$ locate Python.h /usr/include/python2.7/Python.h 

Once you know that you have the header file, try to see where the compiler is looking for it:

cd PyQt_installation_dir grep -r python2.7 . ... ./QtNetwork/QtNetwork.pro:INCLUDEPATH += /usr/local/include/python2.7 ... 

In my case the problem was that the file was in /usr/include/python2.7, but the Makefile include path (-I) contained /usr/local/include/python2.7. To work around this, I made a link:

cd /usr/local/include ln -s ../../include/python2.7 . 

Maybe there is a nicer way to do this, but at least the compilation worked.

Best, Harri

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like