当前位置:   article > 正文

Windows 10 PyQt5安装总结

Windows 10 PyQt5安装总结

下载pyqt5安装文件的页面:
https://pypi.org/project/PyQt5/#files

我的电脑的操作系统版本是Windows10 专业版 64位。
选择下载安装包:PyQt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-none-win_amd64.whl (53.1 MB)

 


然后在命令行安装,碰到第一个问题:

C:\Users\xyz>pip install C:\Users\xyz\Downloads\PyQt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-none-win_amd64.whl
PyQt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-none-win_amd64.whl is not a supported wheel on this platform.

通过上网搜索得知[1],一般出现这种错误是因为下载的whl文件的命名格式和系统支持的格式不同。
根据以下代码查看自己本地pip支持安装的whl文件格式:

C:\Users\xyz>python
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> print(pip.pep425tags.get_supported())
>>> [('cp34', 'cp34m', 'win_amd64'), ('cp34', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp34', 'none', 'any'), (
>>> 'cp3', 'none', 'any'), ('py34', 'none', 'any'), ('py3', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any')
>>> , ('py31', 'none', 'any'), ('py30', 'none', 'any')]


出现该问题的原因应该是我的python版本比较低,升级python版本至python-3.8.2后解决了该问题。


然后碰到了第二个问题:

C:\Users\xyz>pip install Downloads\PyQt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-none-win_amd64.whl
Processing c:\users\xyz\downloads\pyqt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-none-win_amd64.whl
Collecting PyQt5-sip<13,>=12.7 (from PyQt5==5.14.1)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'Ne
wConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001BB2D5D5700>: Failed to estab
lish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pyqt5-sip/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'Ne
wConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001BB2D5C9AF0>: Failed to estab
lish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyqt5-sip/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'Ne
wConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001BB2D5B1670>: Failed to estab
lish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyqt5-sip/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'Ne
wConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001BB2D5B14F0>: Failed to estab
lish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyqt5-sip/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'Ne
wConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001BB2D625B20>: Failed to estab
lish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyqt5-sip/
  ERROR: Could not find a version that satisfies the requirement PyQt5-sip<13,>=12.7 (from PyQt5==5.14.1) (from versions
: none)
ERROR: No matching distribution found for PyQt5-sip<13,>=12.7 (from PyQt5==5.14.1)

从错误log看,应该是网络连接有异常,导致下载安装依赖包失败。后把上网方式由使用HTTP代理改为直连网络后,问题解决。

C:\Users\xyz>pip install Downloads\PyQt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-none-win_amd64.whl
Processing c:\users\xyz\downloads\pyqt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-none-win_amd64.whl
Collecting PyQt5-sip<13,>=12.7 (from PyQt5==5.14.1)
  Downloading https://files.pythonhosted.org/packages/27/29/6cb76e960b7a58d58a2a6b87c679d4c00dae80efd03b20e1eb9e9fc30b2d
/PyQt5_sip-12.7.1-cp38-cp38-win_amd64.whl (59kB)
     |████████████████████████████████| 61kB 231kB/s
Installing collected packages: PyQt5-sip, PyQt5
Successfully installed PyQt5-5.14.1 PyQt5-sip-12.7.1
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\xyz>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3
/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 285kB/s
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-20.0.2


参考帖子:
1. python—whl文件介绍与安装
https://blog.csdn.net/Weightwwc/article/details/79594557

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/342107
推荐阅读
相关标签
  

闽ICP备14008679号