错误:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

 
上官瑾文  2018-07-26 14:57:34 浏览45376
  • python
  •  
  • docker
  •  
  • shell
  •  
  • 镜像
  •  
  • Image
  •  
  • pip
  •  
  • read
  •  
  • dockerfile
  •  
  • ReadTimeoutError
 

场景

在用Dockerfile制作镜像的时候总是出现如下错误
错误:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out._第1张图片

原因分析

在下载python库的时候,由于国内网络原因,python包的下载速度非常慢,查看pip 文档,只要在 pip的时候控制超时即可, 具体参数为 --default-timeout=100, 后面的时间可以自己指定。

解决

pip install --default-timeout=1000 --no-cache-dir -r requirements.txt

你可能感兴趣的:(错误:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.)