ubuntu15 安装 最新版pyqt

1
2
3
4
5
wget http://download.qt.io/official_releases/qt/5.6/5.6.0/qt-opensource-linux-x64-5.6.0.run

chmod +x qt-opensource-linux-x64-5.6.0.run

./qt-opensource-linux-x64-5.6.0.run

弹出安装界面,填写注册信息和安装位置完成安装

设置qt的路径?环境变量 你安装qt的目录

1
2
sudo 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
5
wget 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
2
make
sudo make install

安装pyqt 去http://www.riverbankcomputing.com寻找最新版pyqt下载地址

1
2
3
4
wget 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
3
qmake: 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.py

1
2
3
python3 configure.py --qmake /home/xq/apps/python/qt5.6/5.6/gcc_64/bin/qmake
make
sudo make install

文章目录
,