首页 > 解决方案 > 我不能在 WSL Ubuntu 上使用 pip

问题描述

如果我尝试使用 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 包而不出错?

标签: pythonflaskpip

解决方案


我用谷歌搜索:pip ProtocolError

有人说:已解决问题是我的宿舍防火墙阻止了 pip (pypi.python.org)。在工作中发出相同的命令可以正确安装 python 包。

请参阅:PIP 不工作 - 代理 - 连接中止

如果此解决方案仍然不适合您,请详细说明您的机器,例如

pip --version, pip3 --version, python3 -V, python -V,cat /etc/issue


推荐阅读