Python &引用;“康达激活”;在bash.exe上失败,即使在git-bash.exe上运行良好

Python &引用;“康达激活”;在bash.exe上失败,即使在git-bash.exe上运行良好,python,bash,shell,conda,git-bash,Python,Bash,Shell,Conda,Git Bash,我想在bash.exe上使用“conda activate”,因为我将其设置为VSCode default terminal。这在F5调试运行时使用 系统 -Windows 10 -Visual Studio代码1.36.1 -康达4.7.10 -Git for Windows v2.22.0 环境变量由Anaconda安装管理器设置,python命令在任何情况下都有效。但是,conda activate不起作用。 此命令在新的bash.exe中失败,错误如下 CommandNotFoundEr

我想在bash.exe上使用“conda activate”,因为我将其设置为VSCode default terminal。这在F5调试运行时使用

系统
-Windows 10
-Visual Studio代码1.36.1
-康达4.7.10
-Git for Windows v2.22.0

环境变量由Anaconda安装管理器设置,
python
命令在任何情况下都有效。但是,
conda activate
不起作用。 此命令在新的bash.exe中失败,错误如下

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'.
CommandNotFoundError:您的shell未正确配置为使用“conda activate”。
如果使用批处理脚本中的“conda activate”,请更改
调用“调用conda.bat激活”。
要初始化shell,请运行
$conda init
当前支持的shell有:
-猛击
-cmd.exe
-鱼
-tcsh
-克逊什
-zsh
-动力壳
有关更多信息和选项,请参阅“conda init--help”。
重要提示:在运行“conda init”后,您可能需要关闭并重新启动shell。
conda activate
仅在以下情况下有效:
1.在git bash.exe上
2.打开bash.exe,通过执行$shell-l重新启动shell,然后“conda activate”

关于1,为什么git-bash.exe和bash.exe之间存在如此大的差异,即使它们是相同的用户和shell(
whoami
echo$shell
),并且可能引用相同的设置文件(
/.bashrc
等)

conda activate
应在新的bash.exe中完成。 我应该检查什么?
谢谢。

这里也有同样的问题。首先,必须从bash shell运行:

conda init bash
它将向
~\.bash\u profile
添加一些命令,但从VSCode启动终端似乎不会运行
.bash\u profile

只需将下面添加的命令从
~\.bash\u profile
移动到
~\.bashrc
,一切正常

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval "$('/c/Miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
# <<< conda initialize <<<
#>>>康达初始化>>>
# !! 此块中的内容由“conda init”管理!!
eval“$('/c/Miniconda3/Scripts/conda.exe''shell.bash''hook')”

#“将您的调用更改为‘CALL conda.bat activate’”:按消息所述执行,因为它是一个windows cmd shell,而不是类似unix的shell。