By using several of pip, pip source for the default rate is really intolerable, so they collected some pip domestic sources, as follows:
Ali cloud http://mirrors.aliyun.com/pypi/simple/
China University of Science and Technology https : //pypi.mirrors.ustc.edu.cn/simple/
watercress (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/
very simple to use, add url directly -i can! as follows:
1 |
|
If you have the following error:
Please use the command:
1 |
|
If you want to configure as the default source, as follows:
the need to create or modify configuration files (usually created),
Linux files in ~ / the .pip / pip.conf,
Windows in% HOMEPATH% \ pip \ pip.ini) ,
modify the content as follows:
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
Thus during use pip to install, it will call the default image.
Temporary use of another source installation package python script as follows:
1 2 3 4 5 6 7 |
|
You can also use to read the file to install it.
ok, only record it, so in the late review!
------ Date: November 1, 2018 increased pip default configuration source Python script, copy to pip_source.py, can be executed.
#!/usr/bin/python
# coding: utf-8
import platform
import os
os_type = platform.system()
if "Linux" == os_type:
fileDirPath = "%s/.pip" % os.path.expanduser('~')
filePath = "%s/pip.conf" % fileDirPath
if not os.path.isdir(fileDirPath):
os.mkdir(fileDirPath)
fo = open(filePath, "w")
fo.write(
"[global]\nindex-url=https://pypi.tuna.tsinghua.edu.cn/simple/\n[install]\ntrusted-host=pypi.tuna.tsinghua.edu.cn\n")
fo.close()
print "Configuration is complete"
elif "Windows" == os_type:
fileDirPath = "%s\\pip" % os.path.expanduser('~')
filePath = "%s\\pip.ini" % fileDirPath
if not os.path.isdir(fileDirPath):
os.mkdir(fileDirPath)
fo = open(filePath, "w")
fo.write(
"[global]\nindex-url=https://pypi.tuna.tsinghua.edu.cn/simple/\n[install]\ntrusted-host=pypi.tuna.tsinghua.edu.cn\n")
fo.close()
print "Configuration is complete"
else:
exit("Your platform is unknow!")