PyQt5的安装及使用(pycharm)

Posted xdd1997

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PyQt5的安装及使用(pycharm)相关的知识,希望对你有一定的参考价值。

参考链接:https://www.cnblogs.com/pywjh/articles/9835931.html

        https://blog.csdn.net/SeekAndFindYou/article/details/81264684

1.安装pythom(略)

2.安装pycharm(略)

3.安装pyqt5

3.1首先是安装pyqt5

pip install PyQt5

出现错误:

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    PyQt5 from https://files.pythonhosted.org/packages/1f/0e/d0390f7ac55c3d4ac041cbdb13fa2b03225a7f8856d52f712e7e398b2208/PyQt5-5.13.2-5.13.2-cp35.cp36.cp37.cp38-none-win32.whl#sha256=14737bb4673868d15fa91dad79fe293d7a93d76c56d01b3757b350b8dcb32b2d:
        Expected sha256 14737bb4673868d15fa91dad79fe293d7a93d76c56d01b3757b350b8dcb32b2d
             Got        c2886891b8915741ee3103cec3156d5282b22e5766187151b139e2044cedb248

WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the python -m pip install --upgrade pip command.

 输入

python -m pip install --upgrade pip

再输入

pip install PyQt5

安装成功!

3.2 安装Qt工具

pip install PyQt5-tools

出现下面错误

ERROR: Could not find a version that satisfies the requirement PyQt5-tools (from versions: none)
ERROR: No matching distribution found for PyQt5-tools

解决方法如下:

https://pan.baidu.com/s/1GVhquhTe5bgrjGRvUVRloQ 提取码:ain0 
下载后得到一个.whl文件
将上面文件放在C:WindowsSysWOW64 目录下

WIN+R输入cmd,回车打开命令提示符:
输入:pip install wheel
然后:pip install PyQt5_Tools-5.7.dev1-py3-none-any.whl
至此就成功安装了pyqt5-tools

安装完成之后先确认一下安装位置,因为之后用的上,正常的话,会在你的python的安装目录下的

pythonx.xLibsite-packages目录下,如图:

技术图片

3.3 安装安装QtDesigner

然后进入pycharm的File下的settings->Tools->External Tools 点加号,

Name:QtDesigner  
Program:之前PyQt5-tools目录下的designer.exe文件 如我的E:Python38Libsite-packagesPyQt5-toolsdesignerdesigner.exe
Working directory:$FileDir$

3.4安装PyUIC

进入pycharm的File下的settings->Tools->External Tools 点加号,

Name:PyUIC  
Program:python目录下的Script下的pyuic5.exe的目录

Argument:
-m
PyQt5.uic.pyuic
$FileName$
-o
$FileNameWithoutExtension$.py

Working directory:$FileDir$

3.5安装PyRCC

进入pycharm的File下的settings->Tools->External Tools 点加号,

Name:PyRCC  
Program:python目录下的Script下的pyrcc5.exe的目录

Argument:
$FileName$
-o
$FileNameWithoutAllExtensions$.py

Working directory:$FileDir$

over,over,over!

 再次声明并致谢:本文参考

https://www.cnblogs.com/pywjh/articles/9835931.html

 https://blog.csdn.net/SeekAndFindYou/article/details/81264684

 

 

 

 

以上是关于PyQt5的安装及使用(pycharm)的主要内容,如果未能解决你的问题,请参考以下文章

PyQt5安装及配置

Python GUI,pycharm+Pyqt5 配置及打包成exe

python 基础 1.2--pycharm 的安装及使用

PyCharm集成PyQt5以及使用

Pycharm安装PyQt5和pyqt5-tools从而使用Qt Designer

Pycharm+Python+PyQt5使用