【发布时间】:2019-09-23 05:08:10
【问题描述】:
如果我尝试使用 pip 下载 Python 包,则会出现以下错误消息。
nblizz@NBLIZZ-PC:~# pip3 install flask-restful
Collecting flask-restful
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Could not find a version that satisfies the requirement flask-restful (from versions: )
No matching distribution found for flask-restful
这些解决方案都不起作用。
- 重新安装 pip
- 重新安装 WSL
- sudo pip3 install [包]
- pip3 install [package] with
rootaccount - sudo -H pip3 install [包]
- pip install --user [包]
如何安装 pip 包而不报错?
【问题讨论】:
-
Python 在 WSL 中默认不安装。我想,你必须先安装 python3。你能检查python是否工作吗?您可以关注这里的文章以获得更多帮助 1.medium.com/@rhdzmota/… 2.medium.com/@sanajitghosh/…
-
你能检查一下网络连接吗
ping 8.8.8.8 -
@AdityaMishra 我已经将 Python 安装到 WSL 并且运行良好。 pip 是唯一的问题。
-
@WaketZheng
ping 8.8.8.8的结果是64 bytes from 8.8.8.8: icmp_seq=1 ttl=121 time=37.7 ms -
pip3 config list的输出是什么?