【问题标题】:Python pip: Can't install matplotlib (ConnectTimeoutError)Python pip:无法安装 matplotlib (ConnectTimeoutError)
【发布时间】:2016-08-02 22:15:41
【问题描述】:

运行以下命令:

pip install matplotlib --disable-pip-version-check

给出以下输出:

Collecting matplotlib
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02D9D0F0>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/matplotlib/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02D9DE70>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/matplotlib/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02D9D890>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/matplotlib/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02D9D8D0>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/matplotlib/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02D9DD90>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/matplotlib/
  Could not find a version that satisfies the requirement matplotlib (from versions: )
No matching distribution found for matplotlib

【问题讨论】:

  • 你能安装其他软件包吗?您是否支持代理?
  • 其他包的行为相同。如何检查我是否在代理后面?
  • 如果您的网络正常,那就是代理问题!

标签: python python-2.7 matplotlib pip


【解决方案1】:

检查您的互联网连接。

您似乎无法访问 Internet。不太可能,PyPi 遇到临时问题,您应该稍后尝试连接。

【讨论】:

  • 我的互联网工作正常,我用相同的连接发布这个问题。是防火墙还是其他类型的安全限制?
  • @zvisofer,它几乎可以是任何东西,包括防火墙和 PyPi 方面的问题。可以通过浏览器访问 PyPi 网站吗?
  • 是的,我可以访问他们的网站
  • @zvisofer,然后尝试更新 pip here 或手动下载并安装 matplotlib。
【解决方案2】:

非常简单的方法一步一步来:-

  1. http://www.lfd.uci.edu/~gohlke/pythonlibs/下载matplotlib(.whl)

  2. matplotlib 还需要numpydateutilpytzpyparsingcyclersetuptools

    过程: 打开>python27>>脚本>复制粘贴 matplotlib.whlfile

  3. 在python27上打开cmd>脚本>pip install matplotlib-1.5.1-cp27-none win_amd64.whl

我认为这是最简单的安装方法。 如果您再次遇到同样的问题,请尝试一下,然后 ping 我。

【讨论】:

    【解决方案3】:

    另一种可能的解决方案 - 我找到了一个可执行的安装程序here

    之前没有通过 Google 找到它。

    【讨论】:

      【解决方案4】:

      尝试忽略缓存:

      pip install matplotlib --no-cache

      不知道这是如何工作的,因为当它说ConnectionTimeoutError 时,我认为它没有使用缓存。如果这对任何人都有效,我很想听听解释。

      【讨论】: