PyPI uses domestic sources

After using pip several times, the speed of the default pip source is really unbearable, so I collected some domestic pip sources, as follows:

Aliyun http://mirrors.aliyun.com/pypi/simple/University of Science and Technology of China https : //pypi.mirrors.ustc.edu.cn/simple/douban http://pypi.douban.com/simple/Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/China _ University of Science and Technology http://pypi.mirrors.ustc.edu.cn/simple/ The usage method is very simple, just add -i and url directly! as follows: 

  

  

 

 



1
# pip install web.py  - i http: / / pypi.douban.com / simple

 
If the following error is reported:




Please use the command:

1
# 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: you

need to create or modify the configuration file (usually created),

the linux file is in ~/.pip/pip.conf, and the

windows file is in %HOMEPATH%\pip\pip.ini),

The modified content is:

[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

 
In this way, when using pip to install, the image will be called by default.

A python script that temporarily installs packages from other sources is as follows:

1
2
3
4
5
6
7
#!/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)


You can also install using a read-in file.
ok, just record it for later reference!

1
# pip install web.py  - i http: / / pypi.douban.com / simple

 
If the following error is reported:




Please use the command:

1
# 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: you

need to create or modify the configuration file (usually created),

the linux file is in ~/.pip/pip.conf, and the

windows file is in %HOMEPATH%\pip\pip.ini),

The modified content is:

[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

 
In this way, when using pip to install, the image will be called by default.

A python script that temporarily installs packages from other sources is as follows:

1
2
3
4
5
6
7
#!/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)


You can also install using a read-in file.
ok, just record it for later reference!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324932360&siteId=291194637