Solve the slow and unsuccessful installation of third-party libraries in Python pip

Change pip source to domestic mirror

Pip is a very easy to use third-party library installation method, but the default source can not be connected, even if sometimes, the success rate is very low, so it is more convenient to switch to a domestic mirror source.

1. Temporary use

You can add the -i parameter to the back when using pip to specify the pip source (Tsinghua University is used here)
eg:

pip install 库名 -i https://pypi.tuna.tsinghua.edu.cn/simple

2. Permanent modification:

linux:
modify ~ / .pip / pip.conf (create one if not), the content is as follows:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

windows:
Create a pip directory directly in the user directory, such as: C: \ Users \ xx \ pip, create a new file pip.ini, the content is as follows

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
Published 21 original articles · won 29 · visited 2830

Guess you like

Origin blog.csdn.net/VariatioZbw/article/details/104604022