一.问题描述:
windows的cmd可以正常使用conda切换环境
为了方便想使用vscode的终端,但是报错:
PS C:\Users\admin\Desktop\MyProject> conda activate objection1.8.4
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
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
- powershellSee 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
二.解决方案
通过查询得知,只需要将vscode的终端切换为cmd即可
首先按ctrl+shift+p打开搜索框,输入user settings
然后在设置里搜索shell.windows
切换默认终端,我这里默认是null,后来改成了cmd
然后新建的终端都是cmd的了,可以看到正常使用conda切换环境
参考文章:Visual Studio Code配置anaconda终端