For Windows system, paste the following line of code into python IDLE and press Enter to execute it, and pip.ini will be created automatically, and the pip source will default to Douban source.
import os ; ini ="[global]\nindex-url = https://pypi.doubanio.com/simple/\n"; pippath=os.environ["USERPROFILE"]+"\\pip\\";exec("if not os.path.exists(pippath):\n\tos.mkdir(pippath)");open(pippath+"/pip.ini","w+").write(ini)
Enter the directory in the terminal under Mac os system:
cd ~/
If the mac user's home directory does not have a .pip folder, then create this folder
mkdir .pip
Then create a new file in the .pip folder
vi pip.conf,
Edit the pip.conf file and write to Alibaba Cloud
[ global]
index-url = http://mirrors.aliyun.com/pypi/simple/[install]
trusted-host=mirrors.aliyun.com
Or you can use the mirror image of Douban:
[ global]
index-url = http://pypi.douban.com/simple
[ install]
trusted-host=pypi.douban.com
Recommended Posts