python - 我无法在 WSL Ubuntu 上使用 pip

标签 python flask 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
  • 重新安装 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/

相关文章:

python - Python 中 UTF-8 CSV 输入的问题

python - 可选的 URL 变量

python - 如何让 pip 查看用 homebrew 安装的软件包?

python - 没有这样的文件或目录 : '/usr/local/bin/pip'

python - 执行查询时 PyODBC Python 3 错误(Ubuntu 14.04)

python - 如何使用 python 的交互式输入运行命令行程序?

python - 如何从 DataFrame 中创建列表?

flask - flask-admin ModelView定制create_form

unit-testing - 在 Flask 单元 pytest 中模拟 current_app

Python3.2 : Installing MySQL-python fails with error "No module named ConfigParser"