更换PIP源以加快软件下载速度
对于使用Python的人来说,经常会用到PIP来安装各种软件包,但是PIP的软件源服务器在国外,速度真心慢,而且经常出现超时错误。所以需要将其软件源替换为国内的镜像站点。我习惯与使用阿里的镜像,其PIP源地址为:https://mirrors.aliyun.com/pypi/simple/
临时使用
在使用pip是加上参数 -i,比如:
永久修改
将阿里云的源地址加到配置文件中去,通过下面的命令获取配置文件的地址:
会得到类似下面的地址,PIP会从上倒下查找配置文件:For variant 'global', will try loading '/etc/xdg/pip/pip.conf'
For variant 'global', will try loading '/etc/pip.conf'
For variant 'user', will try loading '/home/zimo/.pip/pip.conf'
For variant 'user', will try loading '/home/zimo/.config/pip/pip.conf'
For variant 'site', will try loading '/usr/pip.conf'
/etc/pip.conf
文件(修改/etc/xdg/pip/pip.conf未成功...),添加或者修改为以下内容: