错误:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". /root/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
or, for all users, enable conda with
$ sudo ln -s /root/anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH. To do so, run
$ conda activate
in your terminal, or to put the base environment on PATH permanently, run
$ echo "conda activate" >> ~/.bashrc
Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bashrc file. You should manually remove the line that looks like
export PATH="/root/anaconda3/bin:$PATH"
^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
解决该问题需要先运行source activate,先激活base环境,然后再激活anaconda的虚拟环境。
[zhangx@01 plate_license]$ source activate
(base) [zhangx@01 plate_license]$ conda activate envs
(envs) [zhangx@01 plate_license]$
这篇博客主要介绍了在使用conda管理环境时遇到的CommandNotFoundError问题,以及如何正确配置bash以激活conda环境。首先,文章提供了两种永久启用conda命令的方法,针对当前用户和所有用户。然后,解释了如何激活base环境和特定的虚拟环境。最后,提醒用户更新.bashrc文件以避免旧的路径设置导致的问题。
1065

被折叠的 条评论
为什么被折叠?



