title: conda更换软件源
date: 2020-03-07 11:53:23
tags: Setting

修改 condarc 配置文件

这里以添加清华源为例

1
2
3
4
5
6
7
8
9
10
11
12
13
cat <<'EOF' > ~/.condarc
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
auto_activate_base: false
EOF

添加conda环境变量

1
2
3
# 在配置文件中添加,如果是Anaconda,修改miniconda为anaconda
echo "export PATH=~/miniconda3/bin:$PATH" >> ~/.bashrc
source ~/.bashrc