由于某些原因,pypi经常连接缓慢或者直接被墙,因此对于使用pip的同学造成不便。使用全局代理翻墙是一种解决办法,另一种就是使用国内的pypi镜像
找到并验证有效的镜像如下:
http://pypi.douban.com/ 豆瓣
http://pypi.mirrors.ustc.edu.cn/ 中科大
https://pypi.tuna.tsinghua.edu.cn/ 清华
清华镜像每5分钟更新一次,而且速度也较快,推荐
sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
使用超级权限修改 ~/.pip/pip.conf,没有就创建一个,添加以下内容:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple