python - 我不能在 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
这些解决方案都不起作用。
- 重新安装点子
- 重新安装 WSL
- 须藤 pip3 安装 [包]
- pip3 install [package] with
root
account - sudo -H pip3 安装 [包]
- pip install --user [包]
如何安装 pip 包而不出错?
解决方案
我用谷歌搜索:pip ProtocolError
有人说:已解决问题是我的宿舍防火墙阻止了 pip (pypi.python.org)。在工作中发出相同的命令可以正确安装 python 包。
如果此解决方案仍然不适合您,请详细说明您的机器,例如
pip --version
, pip3 --version
, python3 -V
, python -V
,cat /etc/issue
推荐阅读
- java - Google App Script API 访问,在 android 应用程序中使用 OAuth idToken
- prolog - Prolog递归 - 为什么我需要声明一个额外的变量
- python - 绘制高斯混合图
- javascript - 如何编写代码以在 selenium 中查找驾驶考试取消?
- docker - docker compose 自动停止容器
- c# - 错误:索引超出范围。必须为非负且小于集合的大小:sumList[i]=(sumList[i] + formula3[j]); C#
- python - 将数据框行转换为具有重复索引值的列
- ipywidgets - ipywidgets:如何观察 Box 孩子的状态变化?
- openssl - 在 Linux 中使用 openssl 验证签名
- c# - .NET 6.0 中标准库的 FileNotFoundException