contexts
If you're learning Python, it's not enough to master the standard libraries. There are a lot of good third-party libraries that we need to use, for example, the requests library, which is essential for crawlers developed by the famous K-god, is generally a must-have library. Of course, installing third-party libraries is easiest with the pip command.
However, when you install third-party libraries using pip install + package name, you will find that the download speed is very slow, and sometimes it will time out, and when the third-party libraries are quite large, it is really slow. When I first started to learn Python, I was careless, and I didn't expect it to be so slow. When I first started learning Python, I was careless and didn't expect it to be so slow. That said, sometimes when I'm lifting up my pants, it reports that the installation timed out. Ahem, let's get back to the point, today we will teach you to solve this damn turtle speed problem.
There are two main pip speed boosting methods, a temporary speed boost and a permanent speed boost.
Temporary increase in speed
Adding -i + the mirror address to the pip install package name will speed up the pip install exponentially.
The main domestic mirror addresses are as follows:
Tsinghua:/simple
Aliyun: /pypi/simple/
University of Science and Technology of China /simple/
Huazhong University of Science and Technology:/
Shandong University of Technology:/
Douban: /simple/
Therefore, the command to temporarily speed up pip is:
pip install <package-name>==<version> -i /pypi/simple/
Permanently speed up Windows system configurations
1, in C:\Users\Administrator\pip build a file If there is no pip folder in the Administrator, then create a new one, and then create a new file.
2. Enter in the file:
[global]
index-url=/pypi/simple/
[install]
trusted-host=
Just copy and paste the text above using Notepad's default ANSI encoding format.
Mac/Linux System Configuration
1. Open terminal
2. Enter the command:
mkdir .pip
vim .pip/
(These two steps create a new file in the home directory: .pip/)
Press i to enter input mode and copy and paste the following into this file:
[global]
index-url = /pypi/simple/
timeout = 1000
[install]
use-mirrors = true
mirrors = //
Configuration under Pycharm
1. Open Pycharm's Preferences page;
2. Click the "+" in the Project/Python Interpreter interface:
3, click MANAGE REPOSITORIES will be above the mirror source address to fill in after clicking ok can be used:
Well, let's hurry up and configure it ourselves. With the speedup, the ten minutes or so it used to take to install may be reduced to 3 seconds.
This is the whole content of this article, I hope it will help you to learn more.