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

2024-05-19 16:24:47 发布

您现在位置:Python中文网/ 问答频道 /正文

所以,最近我开始学习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'.

在Git Bash终端中,我甚至无法激活基本虚拟环境。虽然我爱抚了另一个名为“xyz”的环境,但我也无法切换到它

使用我的默认首选项(VSCode和gitbash)帮助我处理错误


Tags: andto代码gitbash终端foryour
1条回答
网友
1楼 · 发布于 2024-05-19 16:24:47

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

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

enter image description here

相关问题 更多 >