云服务器每次重启后conda不能用了,应该是系统自动把设置环境变量清除了。如果想继续使用,则可以运行一下
minconda3激活方法:
source ~/miniconda3/bin/activate
anaconda3激活方法:
source ~/anaconda3/bin/activate
你也修改bashrc文件去修改环境变量,方法为
vi ~/.bashrc
在最后一行加入:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/用户名/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/用户名/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/用户名/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/用户名/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
上面是对miniconda3,下面是对anaconda3,注意上面用户名要替换自己真实系统用户名
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/用户名/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/用户名/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/用户名/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/用户名/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
修改完毕后,别忘了让环境变量生效
source ~/.bashrc