第一步:首先進入python安裝目錄下的 【scripts】.
第二步:執行安裝pyqt5的命令: python37 -m pip install pyqt5
出現以下安裝過程代表安裝成功。
第三步:在豆瓣網上安裝pyqt5 ,在後面加上“ -i https://pypi.douban.com/simple
”表示使用豆瓣所提供的鏡像:
命令: python37 -m pip install PyQt5 -i https://pypi.douban.com/simple
第四步:安裝Qt5圖形設計工具: (圖形界面開發工具qt designer、翻譯工具liguist等等的工具)
命令: python37 -m pip install PyQt5-tools -i https://pypi.douban.com/simple
第五步:將pyqt5-tools添加到全局環境變量(Path)中,我的是:
C:python37Libsite-packagespyqt5_tools
第六步:驗證Qt5 是否安裝成功,在pycharm中編寫如下代碼:
import sys from PyQt5 import QtWidgets app = QtWidgets.QApplication(sys.argv) widget = QtWidgets.QWidget() widget.resize(360, 360) widget.setWindowTitle("hello, pyqt5") widget.show() sys.exit(app.exec())
第七步:執行第六步出現以下窗體後,代表pyqt5安裝成功
第八步:安裝pipenv虛擬環境 python37 -m pip install pipenv
第九步:配置pipenv虛擬環境 python37 -m pipenv --three
第十步:虛擬環境激活 python37 -m pipenv shell
[retouched ] Python3.7下安裝pyqt5的方法步驟(圖文)已經有293次圍觀