Solve the problem that the conda command download package is too slow, add or change the domestic mirror source channel

The blogger wrote this blog post when he was learning to use the conda command to install the torch package . For details on the installation method, see: Install torch packages using pip and conda commands

Consider adding domestic mirror sources. Commonly used mirror sites include Tsinghua University open source mirror site , China University of Science and Technology open source mirror site and Alibaba open source mirror site :

Add mirror source command

Note that the order of addition will affect the order of retrieval, and conda install will give priority to the sources added after retrieval. Similar to the principle of the stack in the data structure, the top of the stack is pushed later.
For example : add A, B, C in sequence; C will be retrieved first, then B, then A, and finally the default image source.
If there is a package in C, the latter will not be retrieved, so it can also be understood as changing the mirror source.

Add Tsinghua University image source command:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

Add the image source command of University of Science and Technology of China:

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

Add Ali image source command:

conda config --add channels https://mirrors.aliyun.com/pypi/simple/

After adding the mirror source, it is recommended to add a command to display the search path, so that the package source path will be displayed every time the package is installed:

conda config --set show_channel_urls yes

show all mirror channel paths command

conda config --show channels

insert image description here

Clear added mirror sources

Originally, I wanted to use the conda command https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/to import the pytorch package through this mirror source of Tsinghua University. At present, I only see the pytorch package in this domestic mirror source, but this channel is currently inaccessible.
insert image description here

Remove command: (Note that this command will clear all mirror source paths added by users, and only keep the default path starting with repo.anaconda.com

conda config --remove-key channels

insert image description here


The solution to the problem of slow downloading of the pip command is detailed in: Click to view

Reference:
Tsinghua Open Source Software Mirroring Station Anaconda mirror use help: Click here to view
USTC mirror source: Click here to view
Blog: Click here to view

Guess you like

Origin blog.csdn.net/TommyXu8023/article/details/105148145
Recommended