Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error while compiling PyQt5: Python.h does not exist

I'm trying to install PyQt5 on my Ubuntu 12.04 box. So after downloading it from here I untarred it, ran python configure.py and make. Make however, results in the following:

cd qpy/ && ( test -f Makefile || /opt/qt5/bin/qmake /home/kram/Downloads/PyQt-gpl-5.0/qpy/qpy.pro -o Makefile ) && make -f Makefile 
make[1]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy' is entered
cd QtCore/ && ( test -f Makefile || /opt/qt5/bin/qmake /home/kram/Downloads/PyQt-gpl-5.0/qpy/QtCore/QtCore.pro -o Makefile ) && make -f Makefile 
make[2]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy/QtCore' is entered
g++ -c -pipe -fno-strict-aliasing -O2 -Wall -W -fPIC -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -I/opt/qt5/mkspecs/linux-g++ -I. -I. -I../../QtCore -I/usr/local/include/python2.7 -I/opt/qt5/include -I/opt/qt5/include/QtCore -I. -o qpycore_chimera.o qpycore_chimera.cpp
qpycore_chimera.cpp:21:20: fatal error: Python.h: File or folder does not exist
compilation terminated.
make[2]: *** [qpycore_chimera.o] Error 1
make[2]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy/QtCore' is left
make[1]: *** [sub-QtCore-make_first] Error 2
make[1]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy' is left
make: *** [sub-qpy-make_first-ordered] Error 2

(I translated some parts of the error message from Dutch to English, so some words may be a bit off from the normal wording..)

Does anybody what the problem is here? Where could the relevant Python.h file be?

like image 732
kramer65 Avatar asked Jul 17 '13 11:07

kramer65


People also ask

How do I fix python fatal error H No such file or directory?

Python h no such file or directory is a fatal error. If you are trying to build a shared library using a C extension file, you need to install the development version of Python. For example, if you use Python 3, you need to install the python3-dev.

What package has python H?

Python. h is used by GNU Compiler Collection (gcc) to build applications. You need to install a package called python-dev for building Python modules, extending the Python interpreter or embedding Python in applications.

What is python H?

Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications.


1 Answers

The problem is that the include path for all python headers in every Makefile will be pointing to /usr/local/include/python2.7 , which should have been /usr/include/python2.7

There are 2 possible solutions for this. Either you can change all the occurrence of this in every Makefile or else you can create a symlink to that location

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

Now you can run make

like image 93
Rony Varghese Avatar answered Oct 12 '22 13:10

Rony Varghese