The solution to the frequent failure of pip installation of Python's package manager: modify the pip image source

Commonly used domestic image sources for pip:

https://pypi.tuna.tsinghua.edu.cn/simple/    // 清华
http://mirrors.aliyun.com/pypi/simple/       // 阿里云
https://pypi.mirrors.ustc.edu.cn/simple/     // 中国科技大学
http://pypi.hustunique.com/                  // 华中理工大学
http://pypi.sdutlinux.org/                   // 山东理工大学
http://pypi.douban.com/simple/               // 豆瓣 

Take setting upAlibaba Cloud image source as an example (my computer system is Windows 10):

// 修改 index-url
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
// 修改 trusted-host
pip config set install.trusted-host mirrors.aliyun.com

Insert image description here
Insert image description here

Use pip to install the requests library, and it will be installed successfully quickly; before the image source is modified, there will be a lot of red letters (eyesore).

pip install requests

Insert image description here

Because I have other versions of python installed locally,
so I can check whether the requests library is installed in the correct location:

pip show requests

Insert image description here

Guess you like

Origin blog.csdn.net/ThisEqualThis/article/details/131999255