pip使用豆瓣的镜像源
豆瓣镜像地址:https://pypi.douban.com/simple/
虽然用easy_install和pip来安装第三方库很方便
它们的原理其实就是从Python的官方源pypi.python.org/pypi 下载到本地,然后解包安装。
不过因为某些原因,访问官方的pypi不稳定,很慢甚至有些还时不时的访问不了。
跟ubuntu的apt和centos的yum有各个镜像源一样,pypi也有。
在国内的强烈推荐豆瓣的源
http://pypi.douban.com/simple/
注意后面要有/simple目录。
使用镜像源很简单,用-i指定就行了:
sudo easy_install -i http://pypi.douban.com/simple/ ipython
sudo pip install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple ipython
每次都要这样写? no!,做个别名吧,额,类似于这样
pip install -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com django
好像还不太好,肿么办?写在配置文件里吧。
-
linux/mac用户将它命名为pip.conf, windows用户将它命名为pip.ini. 文件中写如下内容:
[global] timeout = 60 index-url = https://pypi.doubanio.com/simple
** 注意: **如果使用http链接,需要指定
trusted-host
参数[global] timeout = 60 index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.com
-
- 将该文件放置在指定位置.
linux下指定位置为$HOME/.config/pip/pip.conf
或者$HOME/.pip/pip.conf
mac下指定位置为$HOME/Library/Application Support/pip/pip.conf
或者$HOME/.pip/pip.conf
windows下指定位置为%APPDATA%\pip\pip.ini
或者%HOME%\pip\pip.ini
Yesterday is history.
Tomorrow is a mystery.
But today is a gift.
That is why it's called the present.
The old game: give a wolf a taste, then keep him hungry.
Tomorrow is a mystery.
But today is a gift.
That is why it's called the present.
The old game: give a wolf a taste, then keep him hungry.