Set the pip mirror source for python under windows

For Python developers, pip installation packages are all too common. However, the download speed of foreign sources is too slow and wastes time. And often there are problems with installation errors after downloading. Therefore, replacing the pip installation source with a domestic mirror can greatly increase the download speed and increase the success rate of installation. Simply beautiful. Not much to say, how to replace the mirror source under windows next.

1. Temporary use strategy, you can add parameter -i when using pip

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple {some_package}

2. Once and for all strategy, in the windows file manager, enter

%APPDATA%

3. Navigate to a new directory, create a pip folder in the directory, and then create a pip.ini file in the pip folder

4. Enter the following in the newly created pip.ini file, taking the mirror source of Tsinghua University as an example

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

[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

5. List of domestic mirror sources

  • Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/
  • Alibaba Cloud http://mirrors.aliyun.com/pypi/simple/
  • Douban http://pypi.douban.com/simple/
  • University of Science and Technology of China http://pypi.mirrors.ustc.edu.cn/simple/
  • Huazhong University of Science and Technology http://pypi.hustunique.com/
  • Shandong University of Technology: http://pypi.sdutlinux.org/

Guess you like

Origin blog.csdn.net/DearestFriend/article/details/105671163