Using easy_install and pip makes module installation and management in Python very simple. However, if you are in China, the download speed from the official mirror can be frustrating. Just like modifying the mirror address for apt-get or yum, easy_install and pip also need to have their mirror address modified. There are usually two methods to modify the mirror address for easy_install and pip, which can be done using commands or configuration.
Method 1: Temporarily modify easy_install using commands:
easy_install -i http://e.pypi.python.org/simple fabric
pip:
pip -i http://e.pypi.python.org/simple install fabric
Method 2: Modify easy_install using configuration:
- Open pydistutils.cfg
vi ~/.pydistutils.cfg
-
Write the following content:
[easy_install]
index_url = http://e.pypi.python.org/simple
pip:
- Open pip.conf
vi ~/.pip/pip.conf
-
Write the following content:
[global]
index-url = http://e.pypi.python.org/simple
The faster mirror addresses in China are provided by Tsinghua University, with servers located in Beijing. The public server is the official mirror: Public: http://e.pypi.python.org/simple Education network: http://pypi.tuna.tsinghua.edu.cn/simple
The following mirror address is provided by Anjuke: Public: http://pypi.corp.anjuke.com/simple