首页 > 解决方案 > 每次我尝试使用 pip 安装软件包时都会显示错误

问题描述

安装 jupyter 笔记本。每次发生同样的错误。如果我也安装任何其他软件包,错误也是一样的。我目前使用的是最新的 python 3.6.5 版本。我最近下载了 python,我的 windows 版本是 10。

>pip install jupyter
Collecting jupyter
  Using cached https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl
Collecting ipywidgets (from jupyter)
  Using cached https://files.pythonhosted.org/packages/7d/24/fabc09ad81c6071159a4d12d5bfbddcbea69bd9e3b16c3250ef300c0285f/ipywidgets-7.2.1-py2.py3-none-any.whl
Collecting ipykernel (from jupyter)
  Using cached https://files.pythonhosted.org/packages/ab/3f/cd624c835aa3336a9110d0a99e15070f343b881b7d651ab1375ef226a3ac/ipykernel-4.8.2-py3-none-any.whl
Collecting notebook (from jupyter)
  Using cached https://files.pythonhosted.org/packages/c0/66/cfed59f574d03ca5f1b7c5281485a9cc9a0f21342d24e0f057572316dae5/notebook-5.5.0-py2.py3-none-any.whl
Collecting jupyter-console (from jupyter)
  Using cached https://files.pythonhosted.org/packages/77/82/6469cd7fccf7958cbe5dce2e623f1e3c5e27f1bb1ad36d90519bc2d5d370/jupyter_console-5.2.0-py2.py3-none-any.whl
Collecting qtconsole (from jupyter)
  Using cached https://files.pythonhosted.org/packages/90/ff/047e0dca2627b162866920e7aa93f04523c0ae81e5c67060eec85701992d/qtconsole-4.3.1-py2.py3-none-any.whl
Collecting nbconvert (from jupyter)
  Using cached https://files.pythonhosted.org/packages/39/ea/280d6c0d92f8e3ca15fd798bbcc2ea141489f9539de7133d8fe10ea4b049/nbconvert-5.3.1-py2.py3-none-any.whl
Collecting widgetsnbextension~=3.2.0 (from ipywidgets->jupyter)
  Using cached https://files.pythonhosted.org/packages/ff/fa/64acc09fc845a6b2dc0724d6f3f81e829b778ed5e9a7559567b4f19a3f4b/widgetsnbextension-3.2.1-py2.py3-none-any.whl
Collecting ipython>=4.0.0; python_version >= "3.3" (from ipywidgets->jupyter)
  Using cached https://files.pythonhosted.org/packages/b1/7f/91d50f28af3e3a24342561983a7857e399ce24093876e6970b986a0b6677/ipython-6.4.0-py3-none-any.whl
Collecting nbformat>=4.2.0 (from ipywidgets->jupyter)
  Using cached https://files.pythonhosted.org/packages/da/27/9a654d2b6cc1eaa517d1c5a4405166c7f6d72f04f6e7eea41855fe808a46/nbformat-4.4.0-py2.py3-none-any.whl
Collecting traitlets>=4.3.1 (from ipywidgets->jupyter)
  Using cached https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl
Collecting jupyter-client (from ipykernel->jupyter)
  Using cached https://files.pythonhosted.org/packages/94/dd/fe6c4d683b09eb05342bd2816b7779663f71762b4fa9c2d5203d35d17354/jupyter_client-5.2.3-py2.py3-none-any.whl
Collecting tornado>=4.0 (from ipykernel->jupyter)
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001F5B1BF66D8>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/3d/4a/5b321dc86dec06205cfae8e06fd9fa78be57e199b8665dc152c56f7d5b53/tornado-5.0.2-cp36-cp36m-win_amd64.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001F5B1CF3A20>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/3d/4a/5b321dc86dec06205cfae8e06fd9fa78be57e199b8665dc152c56f7d5b53/tornado-5.0.2-cp36-cp36m-win_amd64.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001F5B1CF3A90>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/3d/4a/5b321dc86dec06205cfae8e06fd9fa78be57e199b8665dc152c56f7d5b53/tornado-5.0.2-cp36-cp36m-win_amd64.whl
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001F5B1CF3E10>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/3d/4a/5b321dc86dec06205cfae8e06fd9fa78be57e199b8665dc152c56f7d5b53/tornado-5.0.2-cp36-cp36m-win_amd64.whl
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001F5B1CF3AC8>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/3d/4a/5b321dc86dec06205cfae8e06fd9fa78be57e199b8665dc152c56f7d5b53/tornado-5.0.2-cp36-cp36m-win_amd64.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/3d/4a/5b321dc86dec06205cfae8e06fd9fa78be57e199b8665dc152c56f7d5b53/tornado-5.0.2-cp36-cp36m-win_amd64.whl (Caused by ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001F5B1CF38D0>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)'))

标签: python-3.x

解决方案


这不是 pip 的问题,而是您的防火墙/网络的错误。尝试允许 python3.exe 通过防火墙并以管理员身份运行终端。我刚刚pip install jupyter在我的终端中运行,它安装得很好。

同时更新你的点子

python.exe -m pip install --upgrade pip

另外,运行

ping files.pythonhosted.org

在您的终端中以确保您可以连接


推荐阅读