使用国内镜像源来加速python pypi包的安装

pipy国内镜像目前有:
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 华中理工大学
http://pypi.sdutlinux.org/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学
对于pip这种在线安装的方式来说,很方便,但网络不稳定的话很要命。使用国内镜像相对好一些,如果想手动指定源,可以在pip后面跟-i 来指定源,比如用豆瓣的源来安装web.py框架:
pip install web.py -i http://pypi.douban.com/simple
注意后面要有/simple目录!!!
要配制成默认的话,需要创建或修改配置文件(linux的文件在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini),修改内容为:
code:
[global]
index-url = http://pypi.douban.com/simple
————————
Configuration
Config file
pip allows you to set all command line option defaults in a standard ini style config file.
The names and locations of the configuration files vary slightly across platforms.
On Unix and Mac OS X the configuration file is: $HOME/.pip/pip.conf
On Windows, the configuration file is: %HOME%\pip\pip.ini

You can set a custom path location for the config file using the environment variable PIP_CONFIG_FILE.

The names of the settings are derived from the long command line option, e.g. if you want to use a different package index (–index-url) and set the HTTP timeout (–default-timeout) to 60 seconds your config file would look like this:
[global]
timeout = 60
index-url = http://download.zope.org/ppix

———————————
方法2:配置方式修改
easy_install:
1.打开pydistutils.cfg
vi ~/.pydistutils.cfg
——
2.写入以下内容
[easy_install]
index_url = http://e.pypi.python.org/simple
————————
pip:
1.打开pip.conf
vi ~/.pip/pip.conf
2.写入以下内容
[global]
index-url = http://e.pypi.python.org/simple
速度比较快的国内镜像,都来自清华大学,服务器在北京。公网的服务器为官方镜像
公网:http://e.pypi.python.org/simple
教育网:http://pypi.tuna.tsinghua.edu.cn/simple