Python install third-party libraries, pip install slow installation, installation solutions fail

New to python friend, during use pip install python install third-party libraries will appear in speed is very slow, or install the downloaded to the middle, stopped, stuck, or downloading error and other problems.
Below, the download speed only 4.7kb / s slower than turtle speed slower.
Here Insert Picture Description
This is because most official sources are abroad, although you can download, but due to the speed limit issue, download very slow.

So how to solve this problem?
That is to replace the python source

Temporary use is in the installation pip install -i + source address + installation library name , which can temporarily solve installation problems

例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python

This way will go to the library to install opencv-python from Tsinghua mirror

Another way is to permanently modify the source, where my approach is to modify on win10 and effective pro-test
1. Windows under the C drive, Users directory, find the name of your computer, go to the directory
where my name is Administrator
Here Insert Picture Description
2. after entering the directory, create a folder named PIP
Here Insert Picture Description
3. into this folder, create a configuration file named pip.ini, where some people may not operate, you can create txt file
to open the Add content, and then change the name of pip.ini
Here Insert Picture Description
4. contents of the file adding the source address of Tsinghua
[Global]
index-URL = https://pypi.tuna.tsinghua.edu.cn/simple

Here Insert Picture Description
5. the save, modify the configuration file name pip.ini
Here Insert Picture Description
6. at this time modified good, you can use, very fast
Here Insert Picture Description
in the linux environment, modify the ~ / .pip / pip.conf this document. If not, create one directory to be created correctly.
As the content
[Global]
index-URL = https://pypi.tuna.tsinghua.edu.cn/simple

well after modification, can be used.

Some domestic sources:

The new ubuntu require the use of https source, to pay attention.

Tsinghua: https://pypi.tuna.tsinghua.edu.cn/simple
Ali cloud: http://mirrors.aliyun.com/pypi/simple/
China University of Science and Technology https://pypi.mirrors.ustc.edu.cn / simple /
Huazhong University of Science: http://pypi.hustunique.com/
Shandong University of Technology: http://pypi.sdutlinux.org/
watercress: http://pypi.douban.com/simple/

Published 10 original articles · won praise 20 · views 4375

Guess you like

Origin blog.csdn.net/Joker00007/article/details/104453837