pycharm 安装pyqt实现界面编程;
参考资料: https://www.cnblogs.com/huluwa508/p/10319568.html https://blog.csdn.net/qq_33475105/article/details/82192916 安装包: python_dotenv-0.10.3-py2.py3-none-any.whl PyQt5_sip-12.7.0-cp36-cp36m-win32.whl PyQt5-5.13.2-5.13.2-cp35.cp36.cp37.cp38-none-win32.whl pyqt5_tools-5.13.0.1.5-cp36-none-win32.whl 安装whl文件命令格式:本机(windows64) pip install xxx.whl 1,可能需要更新pip 2,安装wheel,pip install wheel; 3,本机使用 版本如下: 安装完成后检查: pip list查看是否有以下文件: PyQt5 5.13.0 PyQt5-sip 12.7.0 pyqt5-tools 5.13.0.1.5 python-dotenv 0.10.3 安装错误: 1,提示版本不符本机平台要求,需要重新下载; 2,命令行中存在空格; 按照参考页配置: setting-tools-External tools : QtDesigner 1,E:\Python36-32\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe 2,$FileDir$ PyUIC 1,E:\Python36-32\python.exe 2,-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py 3,$FileDir$ 如果出现错误: from PyQt5 import QtCore, QtGui, QtWidgets ModuleNotFoundError: No module named ‘PyQt5‘ 修改: File-settings-Project interpreter-修改为python.exe目录(python3.6安装目录,E:\Python36-32\python.exe 右键工程或者直接单击菜单栏的“Tools”,选择External Tools>>QtDesigner打开QtDesigner,创建一个MainWindow,编辑如下: 然后保存到当前工程目录下为hello.ui,右键选中hello.ui,External Tools>>PyUIC,生成hello.py。 新建main.py,添加如下代码: import sys import hello # 导入ui from PyQt5.QtWidgets import QApplication, QMainWindow if __name__ == ‘__main__‘: app = QApplication(sys.argv) ui = hello.Ui_MainWindow() mainWnd = QMainWindow() ui.setupUi(mainWnd) mainWnd.show() sys.exit(app.exec_()) OK!
相关推荐
meylovezn 2020-09-15
zhongfuyu 2020-08-16
JimyFengqi 2020-08-16
追逐阳光的风 2020-07-04
hustlei 2020-06-21
lianback 2020-06-21
王磊的程序员之路 2020-06-21
kikaylee 2020-06-12
生物信息学 2020-06-07
hustlei 2020-06-04
zhongfuyu 2020-05-30
hustlei 2020-05-19
zhongfuyu 2020-05-19
zhongfuyu 2020-05-14
JasonYeung 2020-05-09