Python 为什么在VS代码中使用MiniConda时出错?

Python 为什么在VS代码中使用MiniConda时出错?,python,visual-studio-code,anaconda,data-science,git-bash,Python,Visual Studio Code,Anaconda,Data Science,Git Bash,所以,最近我开始学习Python for Data Sc,并安装了miniconda。我计划使用VS代码进行练习。我在VS代码中添加了python.exe路径。但当我从VSCode开始在默认Git Bash终端中执行python程序时,它给出了以下错误: $ conda activate base CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. If using

所以,最近我开始学习Python for Data Sc,并安装了miniconda。我计划使用VS代码进行练习。我在VS代码中添加了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'.
$conda激活基地
CommandNotFoundError:您的shell未正确配置为使用“conda activate”。
如果使用批处理脚本中的“conda activate”,请更改
调用“调用conda.bat激活”。
要初始化shell,请运行
$conda init
当前支持的shell有:
-猛击
-cmd.exe
-鱼
-tcsh
-克逊什
-zsh
-动力壳
有关更多信息和选项,请参阅“conda init--help”。
重要提示:在运行“conda init”后,您可能需要关闭并重新启动shell。
在Git Bash终端中,我甚至无法激活基本虚拟环境。虽然我爱抚了另一个名为“xyz”的环境,但我也无法切换到它


使用默认首选项(VSCode&Git-Bash)帮助我解决错误。

我使用以下命令在Bash终端中激活了conda环境:

  • 使用命令“
    source deactivate
  • 然后使用命令“
    conda deactivate
  • 现在,我们可以使用命令“
    conda activate base
    ”来激活conda环境:

  • 对于相同或类似的问题,有几个问题需要回答:这些问题中有没有一个能帮你解决问题?@saint_sharan-事情进展如何?只是想看看提供的信息是否有用。@jill cheng您的解决方案有效。谢谢你。但是它正在工作,源停用和conda停用不是一样的吗?另外,source conda被折旧了。您能告诉我在输入这些命令之后,实际发生了什么吗?还有,source deactivate和conda deactivate,不是一样吗?@saint_sharan-这两个命令用于退出当前环境。我发现使用“源停用”,然后使用“康达激活基地”也有效。当我使用“conda deactivate”退出当前环境时,它不起作用,但“source deactivate”起作用。