vscode 报错:Your shell has not been properly configured to use ‘conda activate‘
vscode 在使用终端激活python环境时会出现以下报错:
下面展示一些 内联代码片
。
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'.
解决办法:
这个实际上是vscode 的问题,vscode的终端默认是cmd的形式,这个时候就按照代码提示conda init <SHELL_NAME>,输入
conda init powershell
如果不成功,那么说明你的终端默认是powershell,输入
conda init cmd.exe
就可以解决问题。