一、安装PyQt5和PyQt5-tools
使用命令行cmd安装pyqt5
pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple
使用命令行cmd安装qtdesigner
pip install PyQt5-tools -i https://pypi.tuna.tsinghua.edu.cn/simple
在pycharm导入PyQt5
虽然不知道为什么,但是就是要用命令行下载好了库,再用pycharm导入才能成功(要是你用命令行导入成功了也可以不进行这一步)
二、添加QtDesigner和PyUIC工具
⑤QtDesigner是自己定义的工具名字,一般是使用QtDesigner命名
⑥这个是导入PyQt5-tools的designer.exe,网上教程说是在Python->Lib->site-packages->pyqt5_tools文件夹下,反正我是找不到我直接搜索了整个Python文件夹才找到。
⑦
$FileName$
⑤PyUIC工具名称
⑥这个是python程序的python.exe
⑦
-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py
⑧
$FileDir$
现在我们检查一下
点击QtDesigner就会出现这个窗口
好了我们建成了!!!