安装pip源

国内源地址:

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

临时使用命令:

pip install web.py -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

备注:把web.py 改成你要这的软件名称

临时使用源python脚本:

#!/usr/bin/python
import os
package = raw_input("Please input the package which you want to install!
")
command = "pip install %s -i http://pypi.mirrors.ustc.edu.cn/simple --trusted-host pypi.mirrors.ustc.edu.cn" % package
os.system(command)

linux和windows配置成默认的源的方法:

存放在root目录下:

[root@jumpserver pip]# pwd
/root/pip

[root@jumpserver pip]# ll
total 4
-rw-r--r-- 1 root root 52 May  4  2017 pip.conf

内容:

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

windows系统:在%HOMEPATH%pippip.ini

内容:

[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
原文地址:https://www.cnblogs.com/nulige/p/6806552.html