对于Python开发用户来说,PIP安装软件包是屡见不鲜。但国外的源下载速度实在太慢,浪费时间。并且常常出现下载后安装出错问题。因此把PIP安装源替换成国内镜像,能够大幅提高下载速度,还能够提升安装成功率。vim
Linux下,修改~/.pip/pip.conf
bash
若是没有.pip文件夹, 就须要建立一个.文件夹要加“.”,表示是隐藏文件夹阿里云
vim ~/.pip/pip.conf
复制代码
编辑pip.conf文件, 并添加如下内容url
这里使用的是阿里云的pip源spa
[global]
index-url = http://mirrors.aliyun.com/pypi/simple
[install]
trusted-host=mirrors.aliyun.com
复制代码
Windows下,在user目录中建立一个pip目录,如:C:\Users\account\pip,新建文件pip.ini,内容与上面相同:code
[global]
index-url = http://mirrors.aliyun.com/pypi/simple
[install]
trusted-host=mirrors.aliyun.com
复制代码