pip 永久更换第三方源方案

关于linux下 anaconda更换全局清华源 或者 永久更换清华源方案

注:本人亲自使用,且有效。如有雷同,见谅

  1. 先利用pip config set global.index-url 将anconda保存变量的文件引出来,即下文的 /root/.config/pip/pip.conf
[root@localhost ~]# pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
[root@localhost ~]# pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
Writing to /root/.config/pip/pip.conf
  1. 在pip.conf里面修改源
我用清华源出现了下面的问题 所以我使用阿里云源的时候比较多
[root@localhost ~]# vim /root/.config/pip/pip.conf

修改如下

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

可解决的问题:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’: Failed to establish a new connection: [Errno -2] Name or service not known’)':
pip 永久更换第三方源方案_第1张图片
出现上面的问题 选择更换源 比如清华源 阿里云源 华中源 豆瓣源等等

阿里云 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
中国科技大学 -i https://pypi.mirrors.ustc.edu.cn/simple/ 
豆瓣(douban) -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
清华大学 -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
中国科学技术大学 -i http://pypi.mirrors.ustc.edu.cn/simple/ --trusted-host pypi.mirrors.ustc.edu.cn

你可能感兴趣的:(#,其他,virtualenv)