简体   繁体   English

安装pyQt4时找不到sip.h

[英]Cannot find sip.h when installing pyQt4

I'm trying to install PyQt-x11-gpl-4.11 in my ubuntu 13.04 Linux vm, configure-ng.py ran well but when using make, it prompts below error message,** 我正在尝试在我的ubuntu 13.04 Linux vm中安装PyQt-x11-gpl-4.11,configure-ng.py运行良好但是在使用make时,它会提示以下错误消息,**

root@ubuntu:/home/yanwang/Downloads/PyQt-x11-gpl-4.11# make
cd QtCore/ && make -f Makefile 
make[1]: Entering directory `/home/yanwang/Downloads/PyQt-x11-gpl-4.11/QtCore'
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_PLUGIN -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I/usr/local/include/python2.7 -I../qpy/QtCore -I. -o sipQtCoreQTimer.o sipQtCoreQTimer.cpp
In file included from sipQtCoreQTimer.cpp:29:0:
sipAPIQtCore.h:33:17: fatal error: sip.h: No such file or directory
compilation terminated.
make[1]: *** [sipQtCoreQTimer.o] Error 1
make[1]: Leaving directory `/home/yanwang/Downloads/PyQt-x11-gpl-4.11/QtCore'
make: *** [sub-QtCore-make_default-ordered] Error 2
root@ubuntu:/home/yanwang/Downloads/PyQt-x11-gpl-4.11# 

The SIP files are installed under below directory: SIP文件安装在以下目录中:

/home/iriswang/Downloads/sip-4.16.1

While the PyQt files are under directory: 而PyQt文件在目录下:

/home/iriswang/Downloads/PyQt-x11-gpl-4.11

I've setup the environment variable so that it contains the sip directory: 我已经设置了环境变量,以便它包含sip目录:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/iriswang/Downloads/sip-4.16.1:/home/iriswang/Qt5.3.1/5.3/gcc_64/bin

However, it looks like it still can't find sip.h file. 但是,它看起来仍然无法找到sip.h文件。 Any idea what I can do? 知道我能做什么吗? BTW I've installed python-dev package, so it shouldn't be because of that. 顺便说一下,我已经安装了python-dev软件包,所以不应该因为这个原因。 And I checked whether sip is installed successful, looks like it's OK too:** 我检查了sip是否安装成功,看起来也没关系:**

root@ubuntu:/home/iriswang/Downloads# sip -h
Usage:

    sip [-h] [-V] [-a file] [-b file] [-B tag] [-c dir] [-d file] [-e] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-T] [-w] [-x feature] [-X id:file] [-z file] [file]
where:
    -h          display this help message
    -V          display the sip version number
    -a file     the name of the QScintilla API file [default not generated]
    -b file     the name of the build file [default none generated]
    -B tag      add tag to the list of timeline backstops
    -c dir      the name of the code directory [default not generated]
    -d file     the name of the documentation file (deprecated) [default not generated]
    -e          enable support for exceptions [default disabled]
    -g          always release and reacquire the GIL [default only when specified]
    -I dir      look in this directory when including files
    -j #        split the generated code into # files [defaul
...

Thank you very much!** 非常感谢你!**

This seems to be a common problem when installing PyQt for Ubuntu. 在为Ubuntu安装PyQt时,这似乎是一个常见问题。 My research showed two possible solutions on how you could fix this. 我的研究显示了两种可能的解决方案,如何解决这个问题。

(1) You need to update your Python header in the Makefiles to make sure that you are linked to /usr/include/python2.7 instead of /usr/local/include/python2.7. (1)您需要在Makefile中更新Python头,以确保链接到/usr/include/python2.7而不是/usr/local/include/python2.7. See this link for a simple fix: 有关简单修复,请参阅此链接:

Fatal error while compiling PyQt5: Python.h does not exist 编译PyQt5时出现致命错误:Python.h不存在

(2) You can install PyQt4.10 instead of PyQt4.11. (2)您可以安装PyQt4.10而不是PyQt4.11。 Other online users have reported that PyQt4.11 will not install correctly. 其他在线用户报告称PyQt4.11无法正确安装。 See this link here for more info: 有关详细信息,请参阅此链接:

http://iqbalnaved.wordpress.com/2014/05/31/installing-pyqt4-for-python-2-7-6-in-virtual-environement-in-ubuntu-14-04/ http://iqbalnaved.wordpress.com/2014/05/31/installing-pyqt4-for-python-2-7-6-in-virtual-environement-in-ubuntu-14-04/

I would recommend #1 as you should be using the latest version of PyQt. 我建议#1,因为你应该使用最新版本的PyQt。 Be sure to do some additional research as I believe your problem is not unique. 一定要做一些额外的研究,因为我相信你的问题不是唯一的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM