conda手动初始化
问题:环境中存在conda但是conda无法使用
方法: 进入到anaconda目录下, 进入bin目录, 然后执行
source activate
要想启动时自动进入conda环境, 需要在 ~/.bashrc中添加如下命令
# >>> 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 <<<
然后 source ~/.bashrc