1. shell初始化失败
1.1. 现象
一般当我们首次使用conda命令的时候会出现下面的错误:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run$ conda init <SHELL_NAME>Currently supported shells are:- bash- fish- tcsh- xonsh- zsh- powershellSee 'conda init --help' for more information and options.IMPORTANT: You may need to close and restart your shell after running 'conda init'.
选择之后还会报这样的问题:
no change /opt/conda/condabin/conda
no change /opt/conda/bin/conda
no change /opt/conda/bin/conda-env
no change /opt/conda/bin/activate
no change /opt/conda/bin/deactivate
no change /opt/conda/etc/profile.d/conda.sh
no change /opt/conda/etc/fish/conf.d/conda.fish
no change /opt/conda/shell/condabin/Conda.psm1
no change /opt/conda/shell/condabin/conda-hook.ps1
no change /opt/conda/lib/python3.8/site-packages/xontrib/conda.xsh
no change /opt/conda/etc/profile.d/conda.csh
modified /root/.zshrc==> For changes to take effect, close and re-open your current shell. <==
conda还是无法使用
1.2. 原因分析
这是因为设置之后没有重启脚本
1.3. 解决方法
退出后新开一个终端,或者souce shell配置文件,例如
source ~/.bashrc
source ~/.zshrc
参考文献
conda activate激活环境出错的解决办法_condaerror: run 'conda init' before 'conda activat-CSDN博客