1.安装QT库(含QT4和QT5)
sudo apt-get install qt-sdk
2.安装SIP
从官网
http://www.riverbankcomputing.com/software/sip/download
下载最新稳定的tar.gz源码包,当前版本是sip-4.19.13.tar.gz,并解压
python configure.py
make
sudo make install
安装完成后,立即查看sip版本
sip -V
3.安装PyQt5
建议从官网
http://www.riverbankcomputing.com/software/pyqt/download5
sip-4.19.13搭配PyQt5_gpl-5.9.2(PyQt5版本太高会导致无法安装成功)
解压源码后,进入源码目录,运行
python configure.py --sip-incdir=/usr/include/python2.7
若是出错:Error: PyQt5 requires Qt v5.0 or later. You seem to be using v4.8.7. Use the --qmake flag to specify the correct version of qmake.
运行上一步之前,先运行:sudo apt-get install qt5-default
make -j4
sudo make install