1、下载安装包:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
2、安装:
bash Miniconda3-latest-Linux-x86_64.sh
全部输入yes
3、配置conda
vim ~/.bashrc
光标切换到最后一行,按i键插入环境变量地址,环境变量地址在这里有。
按ESC,再按:键输入wq保存退出。
如果没有可以复制:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/root/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/root/miniconda3/etc/profile.d/conda.sh" ]; then
. "/root/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/root/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <
4、刷新:
source ~/.bashrc
出现base:
5、创建环境:
conda create -n torch pip python=3.8
6、设置默认环境:
输入:
vi ~/.bashrc
同样跟上面一样在最后一行追加:
conda activate torch # "torch "就是你的环境
退出保存
刷新:
source ~/.bashrc