Using easy_install and pip can make the installation and management of python modules very convenient. I usually use easy_install pip on a new Linux system and then use pip to install other modules. However, using the official pypi source (https://pypi.python.org/simple) in China is generally slow, and even occasionally connects directly to the timeout, so it is necessary to use the domestic mirror of pypi. Regarding mirroring, I have already recommended it, see this article : Recommendations for common open source mirror sites
This article is to talk about two ways to configure easy_install and pip to use mirror pypi. Take the TUNA mirror source of Tsinghua University as an example: https://pypi.tuna.tsinghua.edu.cn/simple
1. Temporarily use the pypi image during command line installation, that is, add the -i https://pypi.tuna.tsinghua.edu.cn/simple parameter
# easy_install command line easy_install -i https://pypi.tuna.tsinghua.edu.cn/ simple pip # pip install command line pip install -i https://pypi.tuna.tsinghua.edu.cn/simple lxml
2. Set the configuration files of easy_install and pip, and permanently set the pypi mirror source. The command line does not need the -i parameter.
The configuration file of easy_install ~/.pydistutils.cfg Add the following configuration to it:
[easy_install]
index_url = https://pypi.tuna.tsinghua.edu.cn/simple
pip's configuration file ~/.pip/pip.conf (you may need to create a .pip directory and a pip.conf file), add the following configuration to it:
pip pypi mirror source configuration shell
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple