conda activate 激活环境出错

发布于 2021-11-08  3 次阅读


起因

最近vscode更新版本后,遇到了报错(忘了记录下来……),解决方法是需将默认的shell修改为git bash,结果今天conda怎么都激活不了环境

报错信息

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.    
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - cmd.exe
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

于是按照提示conda init,结果还是不行

解决方法

重新激活环境

# 重新进入
source activate

题外话

这里不太建议使用 code runner 插件,建议自己输指令运行,这样运行多个python文件也方便


随心所至