ubuntu sh脚本激活conda 虚拟环境

第一步:初始化coda

命令:sudo gedit ~/.bashrc

第二部:复制其中这样一段代码

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/root/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/root/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/root/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

 

第三部:在结尾处添加

conda activate pyn_env

你可能感兴趣的:(ubuntu sh脚本激活conda 虚拟环境)