PyQt4+fedora20

来源:互联网 发布:win10办公软件激活 编辑:程序博客网 时间:2024/05/22 16:32

确切的说是qt5.4+sip4.16+pyqt4+(g++)的安装。

    • 安装sip
    • 安装qt
    • 欢快地装PyQt4
    • python3中安装pyqt4的过程

安装sip:

首先从riverbank上下载pyqt5(5.4),SIP 4.1.6.
进入sip目录,执行以下语句:

python configure.py

安装qt:

下载pt creator5,我用的是在线安装版
装好后,配置qmake环境变量,参考ubuntu下qmake环境变量配置.
更改~/.bashrc,重启终端,执行以下$source ~/.bashrc使新的环境变量生效.

欢快地装PyQt4:

下载pyqt4,解压进入根目录,

python configure.py

再运行make和make install即可。(注意要使用root登录)

在写pyqt gui的时候,注意不要使用root用户,否则回报错。
over

#

以上是在python2.7下安装的pyqt4,到python3.4里面使用还是不能成行。
再此记录

python3中安装pyqt4的过程:

首先,装sip。

python3 configure.pymakemake install

make的过程中遇到siplib.c:20:20: fatal error: Python.h: No such file or directory这样的报错,不要慌张,请往下看:

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

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

$ sudo yum install python-devel

再运行make和make install 就可以了。

cd 进入PyQt4目录,

python3 configure.pymakemake install

(可以顺利运行的前提三配置好了qmake路径。就是欢快!)
装好后重起终端,在python3中import PyQt4就可以成功运行了。

pyqt教程在官网上还是蛮多的。

0 0