How to configure the pip installation source
This article mainly introduces how to configure the pip installation source, which is very detailed and has a certain reference value. Friends who are interested must read it!
PyPI uses domestic sources
After using pip several times, the speed of the default pip source is really unbearable, so we collected some domestic pip sources, as follows:
Aliyun http://mirrors.aliyun.com/pypi/simple/
Https://pypi.mirrors.ustc.edu.cn/simple/ of University of Science and Technology of China
Douban http://pypi.douban.com/simple/
Https://pypi.tuna.tsinghua.edu.cn/simple/ of Tsinghua University
Http://pypi.mirrors.ustc.edu.cn/simple/ of University of Science and Technology of China
The use method is very simple, directly-I plus url can! As follows:
one
# pip install web.py-I http://pypi.douban.com/simple
If there is an error as follows:
Use the command:
one
# pip install web.py-I http://pypi.douban.com/simple-- trusted-host pypi.douban.com
If you want to configure it as the default source, the method is as follows:
Need to create or modify configuration files (usually created)
The file of linux is in ~ / .pip/pip.conf
Windows at% HOMEPATH%\ pip\ pip.ini)
Modify the content as follows:
[global] index-url = http://pypi.douban.com/simple[install]trusted-host=pypi.douban.com
This way, when installing using pip, the image will be called by default.
The python scripts that temporarily install packages from other sources are as follows:
one
two
three
four
five
six
seven
#! / usr/bin/python
Import os
Package = raw_input ("Please input the package which you want to install!\ n")
Command = "pip install% s-I http://pypi.mirrors.ustc.edu.cn/simple-trusted-host pypi.mirrors.ustc.edu.cn"% package
Os.system (command)
These are all the contents of the article "how to configure the pip installation Source". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!