PIP Instruction Download and installation failed raise readtimeouterror (self. _pool, none, "read timed out.")

Python The column contains this content
35 articles 143 subscriptions

Partners who have just come into contact with Python will certainly use the PIP command to install various third-party libraries, but the readtimeouterror problem often occurs during the installation process.

The reason is that when we use the default PIP source to install the python library, because the downloaded server is abroad, the network speed is particularly slow, and an error will be reported if we don't pay attention. There will be a timeout problem and we can't download it, as shown in the following figure:

Insert picture description here
So how should we solve this problem?

Method 1: modify the default timeout to make PIP patient and increase the waiting time. In fact, it is to modify the PIP configuration file. The instructions are as follows:

PIP3 -- default timeout = 100 install package name

Method 2: use domestic sources for a single time. Since the network speed of foreign servers is not good, is there a server that can be downloaded in China? Of course!

Tsinghua University has a mirror address: https://pypi.tuna.tsinghua.edu.cn/simple , just add“-I website”You can switch to the specified download address.

For example, if you need to download and install the turtle library, you can write the following instructions:

pip install –i  https://pypi.tuna.tsinghua.edu.cn/simple  turtle

Method 3: remember the domestic source website every time you install. It's too troublesome! There's a way once and for all? Of course! Create a new PIP folder and configure the pip.ini file. The steps are as follows:

  1. Create a new PIP folder in the directory C: \ users \ XXX (XXX actually represents the commonly used login users)
    Insert picture description here
  2. Create a new pip.ini file in the PIP folder, and add the following contents:
[global]
timeout = 60000
index-url =  https://pypi.tuna.tsinghua.edu.cn/simple
[install]
use-mirrors = true
mirrors =  https://pypi.tuna.tsinghua.edu.cn

Insert picture description here
In this way, the PIP installation source is changed to the domestic source. Once and for all, the download will access the domestic source, which is very fast. Bloggers use the image source of Tsinghua University. Of course, there are other commonly used image sources in China.

Common image sources in China are as follows:
Alibaba cloud http://mirrors.aliyun.com/pypi/simple/

China University of science and technology https://pypi.mirrors.ustc.edu.cn/simple/ 

Douban http://pypi.douban.com/simple/ 

Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/

University of science and technology of China http://pypi.mirrors.ustc.edu.cn/simple/

When you encounter the PIP download timeout problem, you can basically solve it according to the blogger's above three methods~~~

Creation is not easy, white whoring is not good. Your support and recognition is the biggest driving force for my creation. See you in the next article!

Dragon youth

If there are any mistakes in this blog, please comment and advice. Thank you very much!
Insert picture description here

  • one
    give the thumbs-up
  • 0
    comment
  • one
    Collection
  • One key three links
    One key three links
  • Sweep and share posters

emoticon
Insert expression
©️ 2020 CSDN Skin theme: swimming - white Designer: Bai Songlin Return to home page
Paid inelement
Payment with balance
Click retrieve
Code scanning payment
Wallet balance 0

Deduction Description:

1. The balance is the virtual currency of wallet recharge, and the payment amount is deducted according to the ratio of 1:1.
2. The balance cannot be purchased and downloaded directly. You can buy VIP, c-coin package, paid column and courses.

Balance recharge