The problem that the VsCode terminal cannot use conda to switch environments

1. Problem description:

Windows cmd can use conda to switch environments normally

For convenience, I want to use the terminal of vscode, but an error is reported:

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
  - powershell

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

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

2. Solutions

According to the query, you only need to switch the terminal of vscode to cmd

First press ctrl+shift+p to open the search box, enter user settings

 Then search for shell.windows in the settings

 Switch the default terminal, my default is null here, and later changed to cmd

 Then the newly created terminals are all cmd, and you can see the normal use of conda to switch the environment

 Reference article: Visual Studio Code configures anaconda terminal

Guess you like

Origin blog.csdn.net/OrientalGlass/article/details/130894733