The perfect solution for changing the source of conda to pip and changing the source of ubuntu windows~

1.ubuntu 

        1.1 Conda source change

(1) Generate a configuration file

Type in terminal:

cd
conda config --set show_channel_urls yes

(2) Use vim to open condarc

vim ~/.condarc

(3) Replace with Tsinghuayuan

Type i to change to insert mode, then copy the following content, then press esc to return to command mode, and finally: wq to save and exit

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
ssl_verify: true

        1.2 pip change source

(1) Enter the following commands in sequence in the terminal to create pip and edit the pip configuration file

mkdir ~/.pip/
touch ~/.pip/pip.conf
vim ~/.pip/pip.conf

Note: If you do not have vim, you need to use the following command to install it

sudo apt-get install vim

(2) Replace Huawei source

Press the i key to enter the edit mode, then copy the following content to the file, then press the Esc key, then enter:, and then enter wq! save and exit

[global]
index-url = https://repo.huaweicloud.com/repository/pypi/simple
trusted-host = repo.huaweicloud.com
timeout = 120

 (3) When pip wants to specify other sources

For example, specify Douban source

pip install package -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

package is the name of the package you want to install

2.windows

        2.1 Conda source change

(1) Generate condarc file

Open Anaconda Prompt and enter at the command line

conda config --set show_channel_urls yes

(2) Find and open the condarc file in the user folder, and copy the following content

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - defaults
show_channel_urls: true

        2.2 pip change source

(1) Create a new pip folder

Turn on this computer, enter the C drive, user, user name, and create a new pip folder.

(2) Create a new pip.ini

In the pip folder, create a new text file and rename it pip.ini

 (3) Replace Huawei source

Open pip.ini and copy the following into it

[global]
index-url = https://repo.huaweicloud.com/repository/pypi/simple
trusted-host = repo.huaweicloud.com
timeout = 120

Guess you like

Origin blog.csdn.net/Wjeana/article/details/125096691