为什么在 VS Code 中使用 MiniConda 时出现错误?
Why am I getting an error while using MiniConda in VS Code?
所以,最近我开始学习 Python Data Sc。并安装了 miniconda。我打算使用 VS Code 进行练习。我向 VS Code 添加了 python.exe 路径。但是,当我从 VSCode 在我的默认 Git Bash 终端中开始执行 python 程序时,出现以下错误:
$ conda activate base
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'.
在Git Bash 终端中,我什至无法激活基础虚拟环境。虽然我关心另一个名为“xyz”的环境,但我也无法切换到它。
使用我的默认首选项帮助我解决错误(VSCode & Git Bash)。
我使用以下命令在 bash 终端中激活了 conda 环境:
- 使用命令“
source deactivate
”,
- 然后使用命令“
conda deactivate
”,
- 现在我们可以使用命令“
conda activate base
”激活conda环境:
所以,最近我开始学习 Python Data Sc。并安装了 miniconda。我打算使用 VS Code 进行练习。我向 VS Code 添加了 python.exe 路径。但是,当我从 VSCode 在我的默认 Git Bash 终端中开始执行 python 程序时,出现以下错误:
$ conda activate base
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'.
在Git Bash 终端中,我什至无法激活基础虚拟环境。虽然我关心另一个名为“xyz”的环境,但我也无法切换到它。
使用我的默认首选项帮助我解决错误(VSCode & Git Bash)。
我使用以下命令在 bash 终端中激活了 conda 环境:
- 使用命令“
source deactivate
”, - 然后使用命令“
conda deactivate
”, - 现在我们可以使用命令“
conda activate base
”激活conda环境: