尝试安装PyQt

我的系统是:Linux localhost.localdomain 2.6.32-358.23.2.el6.i686 #1 SMP Wed Oct 16 17:21:31 UTC 2013 i686 i686 i386 GNU/Linux

我之前有在系统上安装QtSDK-5.1.1与QtCreator-2.8.1

从官网上下载PyQt的源码:PyQt4 Download

官网上说:“Before you can build PyQt4 you must have already built and installed SIP” 意思是说必须先安装SIP,于是也下载了SIP。

解压SIP压缩包,进入源码目录,打开README,说是当前目录下有一个build.py,结果我没有找到。但找到了一个configure.py的代码。于是我执行它

$ python configure.py

正常完成,并生成了Makefile。我下意识地执行make,结果:

gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/include/python2.6 -o siplib.o siplib.c
siplib.c:20:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.
make[1]: *** [siplib.o] Error 1
make[1]: Leaving directory `/home/hevake_lcj/Install/qt-downloads/sip-4.15.3/siplib'
make: *** [all] Error 2

通常这种问题出在系统没有安装组件的开发板,只提供了库文件,并没有提供对应的头文件,不能进行二次开发。解决文件就是安装python-devel

$ sudo yum install python-devel

完成安装。再make,顺利通过编译。再sudo make install,也很顺利。测试是否完成安装:

$ sip -h
Usage:
    sip [-h] [-V] [-a file] [-b file] [-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]
    -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 [default 1 per class]
    -k          support keyword arguments in functions and methods
    -m file     the name of the XML export file [default not generated]
    -o          enable the automatic generation of docstrings [default disabled]
    -p module   the name of the consolidated module that this is a component of
    -P          enable the protected/public hack
    -r          generate code with tracing enabled [default disabled]
    -s suffix   the suffix to use for C or C++ source files [default ".c" or ".cpp"]
    -t tag      the version/platform to generate code for
    -T          disable the timestamp in the header of generated files
    -w          enable warning messages
    -x feature  this feature is disabled
    -X id:file  create the extracts for an id in a file
    -z file     the name of a file containing more command line flags
    file        the name of the specification file [default stdin]

安装OK。

解压下载的:PyQt-x11-gpl-4.10.3.tar.gz

进入源码目录,打开README,按说明的步骤:先执行configure-ng.py脚本,然后make,make install。

$ python configure-ng.py
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
This is the GPL version of PyQt 4.10.3 (licensed under the GNU General Public
License) for Python 2.6.6 on linux2.

Type '2' to view the GPL v2 license.
Type '3' to view the GPL v3 license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.

Do you accept the terms of the license? yes

由于这是GPL,所以在执行configure-ng.py时让我们同意协议。输入yes继续。

用了1min顺利完成!接着make,这个过程有一点长,花了20分钟,很顺利。

最后是sudo make install,出了错误:

install -m 755 -p /home/hevake_lcj/Install/qt-downloads/PyQt-x11-gpl-4.10.3/pyuic4 /usr/bin/
strip /usr/bin/pyuic4
strip:/usr/bin/pyuic4: File format not recognized
make: [install_pyuic4] Error 1 (ignored)

最后,虽然这里安装有错误。我按官方例子写的几个程序都没有出现问题。

示例网址:http://zetcode.com/gui/pyqt4/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

后语:

其实CentOS的yum自带PyQt4的,可以用yum直接安装。

时间: 2024-08-04 04:20:58

尝试安装PyQt的相关文章

Windows 7尝试安装更新时出现错误0x80070490

如果基于组件的服务 (CBS) 清单中包含已损坏的文件,则可能会发生此错误.若要解决此问题,您需要执行修复安装. 执行修复安装会将当前的 Windows 安装还原到安装 DVD 的版本.此操作还需要对安装 DVD 中未包含的所有更新进行安装. 注意:执行修复安装不会损坏计算机上当前已安装的文件和程序. 若要对 Windows 7 执行修复安装,请按照下列步骤操作: 1. 关闭所有程序,然后重新启动计算机. 2. 将 Windows 7 DVD 插入计算机的 DVD 驱动器中. 3. 在安装程序窗

尝试安装 Office 时收到无法访问 Windows Installer 服务

当您尝试安装 Microsoft Office 时,可能会收到类似以下内容的错误消息: 无法访问 Windows Installer 服务. 原因分析: 如果 Windows Installer 文件已损坏或丢失,可能会发生此问题. 解决方案: 要解决此问题,请使用下列方法之一. 方法一:使用 Msconfig 工具确认 Installer 服务正在运行 1. 单击"开始",单击"运行". 2. 键入 msconfig,然后单击"确定". 3.

pyqt-ubuntu安装PyQt的IDE, eric总是报错,求解

问题描述 ubuntu安装PyQt的IDE, eric总是报错,求解 解决方案 可以了... 重新安装了下 sudo apt-get install libqscintilla2-dev

Windows 7尝试安装更新时收到以下错误消息0x80073712

如果基于组件的服务 (CBS) 清单已损坏,则可能会发生此错误.若要解决此问题,请尝试按照下列步骤操作.&http://www.aliyun.com/zixun/aggregation/37954.html">nbsp; 运行系统更新准备工具 (Checksur.exe) 1. 下载并运行系统更新准备工具.此工具会运行一次扫描,以检查是否存在可能会阻止将来服务操作的不一致情况. 有关如何下载并运行 Checksur.exe 工具的详细信息,请参阅"Windows 7 的系

ODB——基于c++的ORM映射框架尝试(安装)

这篇博客应该是和之前的重拾cgi一起的.当时为了模仿java的web框架,从页面的模板,到数据库的ORM,都找个对应的库来进行尝试.数据库用的就是ODB,官方网站是http://www.codesynthesis.com/products/odb/. 1.安装 odb是直接提供源代码的,主要包含这几个部分:odb.libodb.libodb-sqlite等,用途分别是: odb是ODB编译器,类似于qt的moc,将c++源码中包含ODB特定宏的代码,生成对应的c++代码. libodb是运行时库

尝试安装PyQt5失败

卡在:编译 qtbase/src/gui/image/qpnghandler.cpp时报错: .obj/qpnghandler.o: In function `QPngHandlerPrivate::readPngHeader()': qpnghandler.cpp:(.text+0xbe2): undefined reference to `png_set_longjmp_fn' .obj/qpnghandler.o: In function `QPNGImageWriter::writeIm

Windows 7尝试安装更新时收到以下错误代码0x80070424

如果您在检查更新时收到 Windows http://www.aliyun.com/zixun/aggregation/34037.html">Update 错误 80070424,则可能是由于 Windows Update 所需的某个服务没有运行所导致.启动所需的 Windows Update 服务的步骤1. 单击「开始」按钮,然后单击"控制面板",打开"管理工具".在搜索框中,键入管理工具,然后单击"管理工具". 2. 双击&

SQL Server 2005 Express安装问题解答

你是否熟悉这样一条谚语:"当一切都正常的时候,总有东西会出错".这话一点也没错,我就遇到了这样的情况.我在多台机器的开发平台下安装了至少十几遍Visual Studio .NET (VS.NET)和SQL Server 2005. 最近,我更换了一块硬盘,重新安装Windows XP系统.还有Partition Magic.NoteTab以及其它一些有用的工具,最后安装了Office 2003. VS.NET.SQL Server 2005以及MSDN.随后点击"开始-〉程序

PHPUnit PHP测试框架安装方法

单元测试是几个现代敏捷开发方法的基础,使得PHPUnit成为许多大型PHP项目的关键工具.这个工具也可以被Xdebug扩展用来生成代码覆盖率报告 ,并且可以与phing集成来自动测试,最后它还可以和Selenium整合来完成大型的自动化集成测试. Windows平台LAMP环境XAMPP 1.7.3下如何安装PHPUnit呢? 首先,以管理员身份运行cmd,使用pear添加phpunit频道: D:\xampp\php>pear channel-discover pear.phpunit.de