鏈接:https://pan.baidu.com/s/1mlpbJximuBRhhGODuCKvGA 密碼:cfzf
1.pip install python-qt5
2.下載鏈接裏面的內容,把Lib/site-packages下的PyQt5放到python2.7安裝目錄下的Lib/site-packages,這個是別人編譯好的pyqt5
# coding=utf-8
import sys
from PyQt5 import QtWidgets
# pyqt窗口必須在QApplication方法中使用
app = QtWidgets.QApplication(sys.argv)
label = QtWidgets.QLabel("<p style='color: red; margin-left: 20px'><b>hell world</b></p>") # qt支持html標籤,強大吧
# 有了實例,就需要用show()讓他顯示
label.show()
sys.exit(app.exec_())
備註:編譯器還是會報錯,但是已經可以運行了