Python Xiaobai: When using the pip package installation command, you will always encounter problems such as pip upgrade failure, ERROR: Exception: Traceback (most recent call last): etc.

Usually the reason for this situation is that the network connection is wrong, because you need to connect to the external network. At this time, the domestic network speed is very slow, so you need to use some domestic mirror sources to download.

Enter the pip update command in the cmd command terminal:

python -m pip install --upgrade pip https://pypi.tuna.tsinghua.edu.cn/simple/

After replacing the mirror, successfully upgrade the pip version
But do you have to follow a mirror URL every time you use pip? You can also choose not, then you need to configure python to install pip default image . Here we choose the image source of Tsinghua University as an example:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/

It can be done in one step.
If you are not at ease, you can use the following command to check whether it has been replaced in the terminal:

pip config list
insert image description here

Common domestic mirror sites:

watercress mirror

http://pypi.douban.com/simple

Ali Cloud

http://mirrors.aliyun.com/pypi/simple/

Mirror image of Tsinghua University

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

University of Science and Technology Mirror

https://pypi.mirrors.ustc.edu.cn/simple/

Guess you like

Origin blog.csdn.net/qq_45926254/article/details/129211129