安装
当前环境下安装
当前环境安装直接使用 pip 指令即可。
-
在线安装 pip install PyQt5 -i https://pypi.douban.com/simple
pip install pyqt5-stubs -i https://pypi.douban.com/simple
pip install pyqt5-tools -i https://pypi.douban.com/simple
-
离线安装
pip download PyQt5 -i https://pypi.douban.com/simple
pip download pyqt5-stubs -i https://pypi.douban.com/simple
PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl
PyQt5_sip-12.9.1-cp38-cp38-win_amd64.whl
PyQt5-5.15.6-cp36-abi3-win_amd64.whl
pip install --no-index -r .\requirements.txt
pip download PyQt5 -i https://pypi.douban.com/simple
pip download pyqt5-stubs -i https://pypi.douban.com/simple
pip download pyqt5-tools -i https://pypi.douban.com/simple
PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl
PyQt5_sip-12.9.1-cp38-cp38-win_amd64.whl
pyqt5_tools-5.15.4.3.2-py3-none-any.whl
pyqt5-5.15.4-cp36.cp37.cp38.cp39-none-win_amd64.whl
pyqt5_plugins-5.15.4.2.2-cp38-cp38-win_amd64.whl
python_dotenv-0.19.2-py2.py3-none-any.whl
qt5_tools-5.15.2.1.2-py3-none-any.whl
click-7.1.2-py2.py3-none-any.whl
qt5_applications-5.15.2.2.2-py3-none-win_amd64.whl
pip install --no-index -r .\requirements.txt
虚拟环境安装
虚拟环境需要手动调用当前环境下的 pip , 大致路径为:...\envs\pyqt5_385\Scripts\pip3.exe 完整指令: ...\envs\pyqt5_385\Scripts\pip3.exe install PyQt5 -i https://pypi.douban.com/simple
Pycharm 配置
配置
-
step1 安装好后可以 win 搜索 designer 查看是否安装成功 -
step2 打开PyCharm,打开File—>Settings—>External Tools,点击加号来添加自己的工具 Name:QtDesigner
Group:Qt
Programs:F:\anaconda\Library\bin\designer.exe(这里是各位自己的designer路径,之前所看到的)
Working directory:$ProjectFileDir$
-
step3 但是要在PyCharm中把界面的.ui文件转换为.py文件还需要后面的配置。 重复上述操作,配置pyuic: Name:Pyuic
Group:Qt
Program:F:\anaconda\python.exe(各位自己的python路径)
Arguments:-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py
Working directory:$FileDir$
测试
回到PyCharm,Tools—>Qt—>QtDesigner,点击即可打开designer:
然后创建一个最简单的界面,把这个界面保存(默认是保存在当前pycharm项目目录下,我这里命名“first.ui”)
回到pycharm,可以看到工程目录下已经产生了first.ui,右键它,Qt—>Pyuic,点击后即可产生first.py文件,OK接下来就可以愉快地写代码了(⊙o⊙)…
|