python 安装第三方库,超时报错--Read timed out.

[ops@dbrestore mysql-manage]$ pip install ansible
Collecting ansible
  Downloading https://files.pythonhosted.org/packages/17/c9/d379b76ecaa42f4ee08b01c365e9ed1be0b302ff8a26eef120d481b144fa/ansible-2.8.0.tar.gz (14.3MB)
    19% |██████▍                         | 2.8MB 9.0kB/s eta 0:21:13Exception:
Traceback (most recent call last):
  File "/home/ops/mypy/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 360, in _error_catcher
    yield
  File "/home/ops/mypy/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 442, in read
    data = self._fp.read(amt)

  

解决方法,设置超时时间

pip --default-timeout=100 install ansible

[ops@dbrestore mysql-manage]$ pip --default-timeout=100 install ansible
Collecting ansible
  Downloading https://files.pythonhosted.org/packages/17/c9/d379b76ecaa42f4ee08b01c365e9ed1be0b302ff8a26eef120d481b144fa/ansible-2.8.0.tar.gz (14.3MB)
    100% |████████████████████████████████| 14.3MB 977kB/s 

  

原文地址:https://www.cnblogs.com/Camiluo/p/10959381.html