docker - pip 升级 TooManyRedirects 异常

标签 docker redirect pip upgrade

我正在尝试在 docker 容器内 pip install --upgrade pip,但是,我收到错误:

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 577, in _prepare_file
    session=self.session, hashes=hashes)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 810, in unpack_url
    hashes=hashes
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 649, in unpack_http_url
    hashes)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 842, in _download_http_url
    stream=True,
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 597, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 113, in resolve_redirects
    raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects)
TooManyRedirects: Exceeded 30 redirects.

有谁知道这是什么原因,和/或如何解决?

最佳答案

服务器向 pip 客户端发出重定向。假设您使用的是默认 PyPI 而不是代理,首先要检查的是位于 status.python.org 的 Python 状态页面。 .

这是最近发布的:

Update - We are currently investigating redirect loops for some package installs.

Apr 16, 15:22 UTC

最近还有这个:

Update - We've rolled out a fix for the redirect issue on files.pythonhosted.org for the new PyPI and are monitoring.

Apr 16, 15:35 UTC

关于docker - pip 升级 TooManyRedirects 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49860980/

相关文章:

.htaccess - 将 https 重定向到非 www,将 http 重定向到 www

docker + 节点模块 : receiving error for local dependency while trying to run Dockerfile

docker - Docker覆盖网络阻止IP转发

在 "could not access file $libdir/..."中为 Postgres 11 结果创建扩展

macos - 我可以在 Docker Desktop for Mac 上运行 Windows 容器吗?

PowerShell 在使用 tee-object 时删除控制台消息颜色

python - Scrapy 立即跟随 302 重定向

python - PyTorch 安装失败找不到满足要求的版本

installation - Tensorflow安装错误: not a supported wheel on this platform

python - pip 或 pip3 installrequirements.txt 的问题我应该做什么来修复此错误?