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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值