02_00_pip install镜像问题

在ubuntun里面,均是用pip install方式来安装python的开发包,但发现进度条很慢,并且不能安装成功,因此,网上找了几种方法,是pypi镜像问题。

截止至今天,还能用的链接如下:

官方:https://pypi.python.org/simple

豆瓣:http://pypi.douban.com/simple

中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple

清华:https://pypi.tuna.tsinghua.edu.cn/simple

这里使用清华镜像,据说每5分钟有更新。

 

 

临时使用:

可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple

例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent,这样就会从清华这边的镜像去安装gevent库。

 

永久修改,一劳永逸:

Linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:

 [global]
 index-url = https://pypi.tuna.tsinghua.edu.cn/simple

 

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下

 

 [global]
 index-url = https://pypi.tuna.tsinghua.edu.cn/simple


////////////////////////////////////////////////////////////////////////////////////////////////
2016.11.11 更新
///////////////////////////////////////////////////////////////////////////////////////////////
当更新了pip,又或者从linux的桌面版更新到服务器版,出现该方法不行了,采用以下方法
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host = pypi.douban.com
 
posted @ 2016-11-09 00:26  embshan  阅读(278)  评论(0编辑  收藏  举报