- 对python写gui感兴趣自学一下
- 安装python写界面工具pyqt
去网址 http://download.qt.io/official_releases/qt/
找最新版本的pyqt
我找到的最新版本:http://download.qt.io/official_releases/qt/5.6/5.6.0/qt-opensource-linux-x64-5.6.0.run
1 | wget http://download.qt.io/official_releases/qt/5.6/5.6.0/qt-opensource-linux-x64-5.6.0.run |
弹出安装界面,填写注册信息和安装位置完成安装
设置qt的路径?环境变量 你安装qt的目录1
2sudo gedit /etc/profile
export PATH=$PATH:/home/userXXX/Qt/Qt5.5/gcc_64/bin
安装OpenGL的支持1
sudo apt-get install libgl1-mesa-dev
安装sip,去http://www.riverbankcomputing.com寻找最新版sip下载地址1
2
3
4
5wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.17/sip-4.17.tar.gz
tar -zvxf sip-4.17.tar.gz
cd sip-4.17
python3 configure.py
make
这里报错1
siplib.c:20:20: fatal error: Python.h: 没有那个文件或目录
解决方法是安装python-dev,这是Python的头文件和静态库包:1
sudo apt-get install python3-dev
重新编译:1
2make
sudo make install
安装pyqt 去http://www.riverbankcomputing.com寻找最新版pyqt下载地址1
2
3
4wget http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5.1/PyQt-gpl-5.5.1.tar.gz
tar -zvxf PyQt-gpl-5.5.1.tar.gz
cd PyQt-gpl-5.5.1
python3 configure.py
这里报错1
2
3qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
Error: PyQt5 requires Qt v5.0 or later. You seem to be using v3. Use the
--qmake flag to specify the correct version of qmake.
解决方法在你qt安装目录搜索:qmake的路径然后重新python configure.py1
2
3python3 configure.py --qmake /home/xq/apps/python/qt5.6/5.6/gcc_64/bin/qmake
make
sudo make install