Due to some irresistible factors, Python's official package is sometimes inaccessible or network-unstable in the country. To solve this problem, you need to modify the source address that comes with the PIP to the mirror address.
The more well-received image addresses currently collected are:
http://pypi.v2ex.com/simple/
http://pypi.douban.com/simple/
http://mirrors.aliyun.com/pypi/simple/
How to modify the configuration directly:
Windows system
Create the PIP directory under the User folder and create the Pip.in file (%homepath%pippip.ini) in the PIP directory, and add the following to the file:
[Global]
Trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
Note: Index-url is the source address, Trusted-host is the domain name of the source address, because the domestic source image is the use of HTTPS protocol, so if you do not add the trust domain will be reported:
This repository located at Mirrors.aliyun.com are not a trusted host, if this repository was available via HTTPS it is recom Mend to use HTTPS instead, otherwise the silence this warning with ' –trusted-host mirrors.aliyun.com '.
Deprecation:implicitly allowing locations which is not hosted at a secure origin is deprecated and would require the use Of–trusted-host in the future.
Requirement already UP-TO-DATE:PIP In/usr/lib/python2.7/site-packages
Linux Systems
The only thing that is different from the Windows system is the address of the configuration file, the Linux file in ~/.pip/pip.conf
Do not change the configuration file, each time manually specify:
Pip Install-i http://<mirror>/simple <package>
For example
Pip Install-i http://pypi.douban.com/simple Simplejson
This article is from the "My Ops Time" blog, so be sure to keep this source http://aaronsa.blog.51cto.com/5157083/1859600
Python pip Modify Source