Why do many people like to use python, because the package ah, a variety of transfer package. But the transfer of packages sometimes also transfer the disturbing, because the installation of packages is either failed or very slow, very much affecting the progress of their own work, here is a pip to give a quick installation of the toolkit, I hope to help some of the new entrants to the python students.
When we use the command: pip install package name. File format When the installation often fails, you will see the progress bar of the download, but the final display when the download to a few ten percent of the window will appear a bunch of red letters, there are similar tips as follows:
These pictures above show that there is a problem with python third-party library download, this is because when we do pip installation in cmd window, the default is to go to download foreign resources, due to the domestic network problems often unstable or even no network speed, which will lead to errors when installing the package. There are two solutions:
1, the first is a stupid method, first search for the required installation package, and then go to foreign sites to download the installation package. (Remember: the name of the installation package you want to download is the name of the installation package you pip installation in the cmd window when the program automatically searches for the installation package to download the name, in addition to try to select the Thunderbolt download, the browser downloads often do not have the speed) after the download on the cd to the folder where you download the package to install it. In the cmd window for local file package installation, you can see in the window the system may automatically install the relevant necessary other packages, there may also be a download failure, this situation only need to download the package can not be down to continue to go to foreign sites to download and then locally installed can be.
2, the second is a once-and-for-all method, choose the domestic mirror source, equivalent to you from some domestic organizations to download your required python third-party libraries, so the speed of the bar. So how to choose the domestic mirror source it, how to configure it?
First find C:\Users\Administrator\AppData\Roaming, this path to the folder, some people will not be able to find, this is because your folder is hidden, the solution is as follows:
Open the c-disk, click "View" in the upper left corner - "Options" (folder options) - check "Show hidden files", and then OK. Then you can see the AppData folder. (As shown in the picture below)
Find the path, preferred in the path under the new folder, named "pip", and then in the pip folder in a new txt format text file, open the text file, the following code will be copied to the text file, close and save. Then rename the txt file to " ", so that a configuration file is created.
[global] timeout = 60000 index-url = https:// /simple [install] use-mirrors = true mirrors =
The link address in the document can also be replaced with others as follows:
AliCloud http:// /pypi /simple/
University of Science and Technology of China /simple/
Douban (douban) http:// /simple/
Tsinghua University https:// /simple/
University of Science and Technology of China http:// /simple/
The newly created configuration file is shown below:
So that when you use pip for package installation again, you will choose the domestic source for installation by default, and it's super fast!!!!
This is the whole content of this article, I hope it will help you to learn more.