如果我尝试使用 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 [软件包]
- 使用
root
帐户安装 [package] pip3 - sudo -H pip3 install [软件包]
- pip install --user [软件包]
如何安装 pip 包而不出错?
最佳答案
尝试了所有解决方案,对我来说解决问题的是通过从 Windows CMD 运行来更新 wsl
wsl --update
关于python - 我无法在 WSL Ubuntu 上使用 pip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55990369/