PHPz2017-04-17 11:20:34
Create a file ~/.pip/pip.conf with the following content
[global] index-url = http://b.pypi.python.org/simple [install] use-mirrors = true mirrors = http://b.pypi.python.org
http://pypi.python.org/mirrors
ringa_lee2017-04-17 11:20:34
It is recommended to use the mirror: http://e.pypi.python.org. This is the IP of Beijing and will be much faster.
In addition, you can set a timeout = 6000 in the [global] block to avoid incomplete downloading of the installation package when the network is slow.
[global] timeout = 6000 index-url = http://e.pypi.python.org/simple [install] use-mirrors = true mirrors = http://e.pypi.python.org
阿神2017-04-17 11:20:34
You can also specify the installation source of a single library
pip install flask -i http://pypi.v2ex.com/simple
黄舟2017-04-17 11:20:34
Or try the v2ex source
Create the file pip.conf under ~/.pip/ (if you don’t have one already) and fill in the following content:
[global] index-url = http://pypi.v2ex.com/simple
迷茫2017-04-17 11:20:34
Regarding the new version of HTTP insecurity error, I will give you a template.
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple/
[install]
use-mirrors = true
mirrors = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
阿神2017-04-17 11:20:34
pip install -i https://pypi.doubanio.com/simple/ 包名
The addresses provided by many answers are either closed or redirected, and the new version must use https. It is recommended to use the above one for domestic mirrors.
I personally do not recommend changing the source address by default to avoid security risks.
迷茫2017-04-17 11:20:34
Check the mirror activity in PyPI Mirror. Just select the appropriate image for the CN region.
The specific configuration method is as follows
Using a mirror
Single Usage:
pip install -i http://<mirror>/simple <package>
Global settings:
Add ~/.pip/pip.conf that includes:
[global]
index-url = http://<mirror>/simple
PHP中文网2017-04-17 11:20:34
The above mainly talks about mirror, another option is proxy:
pip install package --proxy=[代理地址]
Posting some useful Pypi mirrors:
Douban
University of Science and Technology of China
怪我咯2017-04-17 11:20:34
It is February 20, 2017. The most convenient source is https://pypi.tuna.tsinghua.ed...
For example, pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade tensorflow-gpu
Soon, pip Same thing