一、安装
- 终端安装:
pip install pyqt5
pip install pyqt5-tools
(注意python版本) - PyCharm安装:files->settings->Project Interpreter 右侧边栏点击+号,搜索安装pyqt5和pyqt5-tools。
二、调试
安装完成后, 运行窗体可能出现:could not find or load the Qt platform plugin "windows"的报错提示框:
解决方式: 环境变量配置:
- 首先找到你的QT安装路径,如果使用的是PyCharm,则直接可以在Project Interpreter中查看:
2.然后在系统高级设置中添加环境变量如下:
注意:这里的路径是上一步你查看得到的你当前python环境下,QT路径中的plugins文件夹