Let the PIP source use domestic mirrors to improve the download speed and installation success rate.
For Python development users, PIP installation of packages is commonplace. But the download speed of foreign sources is too slow and a waste of time. And there are often problems with installation errors after downloading. Therefore, replacing the PIP installation source with a domestic mirror can greatly improve the download speed and the installation success rate.
Domestic source:
The new version of ubuntu requires the use of https sources, so be careful.
Tsinghua University: https://pypi.tuna.tsinghua.edu.cn/simple
Aliyun: http://mirrors.aliyun.com/pypi/simple/
University of Science and Technology of China https://pypi.mirrors.ustc.edu.cn/simple/
Huazhong University of Science and Technology: http://pypi.hustunique.com/
Shandong University of Technology: http://pypi.sdutlinux.org/
Douban: http://pypi.douban.com/simple/
temporary use:
You can add the parameter -i https://pypi.tuna.tsinghua.edu.cn/simple when using pip,
for example: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider, so that The pyspider library will be installed from the mirror on Tsinghua.
Permanent modification, once and for all:
Under Linux, modify ~/.pip/pip.conf (create a folder and file without it. Add "." to the folder, which means it is a hidden folder)
The content is as follows:
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install] trusted-host=mirrors.aliyun.com
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。