When using Python, and pip often used to install the module, but the default download source is really particularly slow, often will install time because of the speed of the direct error, so we can choose to download the source for domestic change, this will increase our download speeds up.
- Well-known domestic source of Download
-
? Ali cloud: http: //mirrors.aliyun.com/pypi/simple/ University of Science and Technology of China: https: //pypi.mirrors.ustc.edu.cn/simple/ Tsinghua University: https: //pypi.tuna.tsinghua.edu.cn/simple/ Watercress: http: //pypi.douban.com/simple/
Mac run in the terminal:
-
cd ~ mkdir .pip touch pip.conf create pip.conf file
Then use the vi command:
-
there pip.conf
Enter the following:
-
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple/ [install] trusted-host=pypi.tuna.tsinghua.edu.cn
Then you can use a pip, download really fast and so many!
- Installation example: requests library
- Direct command:
pip3 install requests
Of course, you can temporarily change the source:
-
pip3 install requests -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com