[Linux] Modifying the mirror address of easy_install and pip
Using easy_install and pip makes installing and managing Python modules very simple. However, if you are in China, downloading 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 two methods to modify the mirror address for easy_install and pip, which can be done through 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 through 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 is provided by Anjuke: Public: http://pypi.corp.anjuke.com/simple