Ubuntu 安装 Anaconda

时间:2023-01-21 13:06:21

下载 anaconda

官网

https://repo.anaconda.com/archive/

国内镜像

https://mirrors.bfsu.edu.cn/anaconda/archive/

https://mirrors.xjtu.edu.cn/anaconda/archive/

https://mirror.bjtu.edu.cn/anaconda/archive/

https://mirrors.hit.edu.cn/anaconda/archive/

https://mirrors.aliyun.com/anaconda/archive/?spm=a2c6h.25603864.0.0.2da34eb925S2Ym

# 以清华源的Anaconda3-2022.10-Linux-x86_64展示
wget https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2022.10-Linux-x86_64.sh

安装 anaconda

sudo sh Anaconda3-2022.10-Linux-x86_64.sh

# Please, press ENTER to continue -> 回车继续
# Do you accept the license terms? [yes|no] -> 同意协议输入yes回车
# 待安装结束

变量环境

普通用户

sudo vim  ~/.bashrc

# 下面的添加到bashrc文件的末尾添加

# anaconda环境
export PATH=/home/ahtelek/anaconda3/bin:$PATH

超级用户

sudo vim /etc/profile

# 下面的添加到profile文件的末尾添加

# anaconda环境
export PATH=/home/ahtelek/anaconda3/bin:$PATH
sudo vim /root/.bashrc

# 在文件的末尾添加
source /etc/profile

配置生效

source ~/.bashrc
source /root/.bashrc

配置国内源

普通用户

conda config --set show_channel_urls yes

vim ~/.condarc

# 复制到.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
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

超级用户

sudo su
conda config --set show_channel_urls yes

vim ~/.condarc

# 复制到.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
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

测试

# 清除索引缓存
conda clean -i

conda create -n name

参考资料