pip安装时出现错误Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken

今天使用pip执行一个快速安装脚本时,出现以下问题

[root@localhost install]# pip install -r requirements.txt 
You are using pip version 7.1.0, however version 20.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting django==1.6 (from -r requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(101, 'Network is unreachable'))': /packages/f1/dd/271a9fa17b95a980ac66c44848fef72d29d904d3e141b219f6e91d1904ec/Django-1.6-py2.py3-none-any.whl

出现错误的原因是下载安装连接国外镜像源超时导致,所以换了一个国内的源

阿里云:http://mirrors.aliyun.com/pypi/simple/

用阿里云源执行安装程序

pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

这里的requirements.txt就是执行安装的脚本,–trusted-host后面表示host,等同于阿里云的域名

你可能感兴趣的:(运维)