转载:ubuntu16.04安装PyQt5

转载链接:https://github.com/pyqt/python-qt5/wiki/Compiling-PyQt5-on-Ubuntu-12.04

安装PyQt5需要安装3个
1 Qt 5.3.1
下载地址:http://download.qt.io/archive/qt/5.3/5.3.1/qt-opensource-linux-x64-5.3.1.run
2 sip-4.16.5
下载地址:http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.5/sip-4.16.5.tar.gz
3 PyQt 5.3.2
下载地址:https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.3.2/PyQt-gpl-5.3.2.tar.gz/download

安装步骤
1 执行Qt5.3.1的文件
./qt-opensource-linux-x64-5.3.1.run
转载:ubuntu16.04安装PyQt5_第1张图片
直接运行下一步安装,安装完成
转载:ubuntu16.04安装PyQt5_第2张图片
2 安装依赖库
sudo apt-get install build-essential
sudo apt-get install python-dev
sudo apt-add-repository ppa:ubuntu-sdk-team/ppa
sudo apt-get update
sudo apt-get install qtdeclarative5-dev
3 安装sip
tar xvzf sip-4.16.5.tar.gz
cd sip-4.16.5/
python configure.py
make
sudo make install
4 安装PyQt
tar zxvf PyQt-gpl-5.3.2.tar.gz
cd PyQt-gpl-5.3.2/
python configure.py –qmake /opt/Qt5.3.1/5.3/gcc_64/bin/qmake –sip-incdir ../sip-4.16.5/siplib (可以通过find gcc_64找到qmake路径)
sudo ln -s /usr/include/python2.7 /usr/local/include/python2.7
make(需要时间比较长,可能1h左右)
sudo make install

验证
import sys
from PyQt5 import QtWidgets
app = QtWidgets.QApplication(sys.argv)
button = QtWidgets.QPushButton(“Hello, World!”)
button.setFixedSize(100, 50)
button.show()
弹出窗口,说明安装成功
转载:ubuntu16.04安装PyQt5_第3张图片
app.exec_()

你可能感兴趣的:(人工智能)