编译PyQt5时出现致命错误:Python.h不存在 [英] Fatal error while compiling PyQt5: Python.h does not exist
问题描述
我正在尝试在Ubuntu 12.04机器上安装PyQt5.因此,从此处下载后,我将其解压缩,并运行python configure.py
和
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..)
有人在这里出什么问题吗?相关的Python.h文件在哪里?
Does anybody what the problem is here? Where could the relevant Python.h file be?
推荐答案
问题是每个Makefile中所有python标头的包含路径都将指向/usr/local/include/python2.7
,而该路径本应为/usr/include/python2.7
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
有2种可能的解决方案.您可以更改每个Makefile中所有这种情况的出现,也可以创建指向该位置的符号链接
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
现在您可以运行make
这篇关于编译PyQt5时出现致命错误:Python.h不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!