关键词

Ubuntu安装Anaconda并且配置国内镜像教程

前言

视频教程

下载 anaconda

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

安装 anaconda

sh Anaconda3-2022.10-Linux-x86_64.sh

变量环境

普通用户变量环境

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

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

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

参考资料

本文链接:http://task.lmcjl.com/news/13966.html

展开阅读全文