vscode 报错:Your shell has not been properly configured to use ‘conda activate

当在Visual Studio Code (VSCode)中尝试激活Python conda环境时,可能会遇到'conda activate'命令未配置正确的错误。根据提示,可以通过运行'condainit <SHELL_NAME>'来初始化终端。如果默认终端是powershell,则运行'condainit powershell';若为cmd.exe,则运行'condainit cmd.exe'。按照此方法通常可以解决VSCode中conda环境激活问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vscode 报错:Your shell has not been properly configured to use ‘conda activate‘

vscode 在使用终端激活python环境时会出现以下报错:

下面展示一些 内联代码片

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'.

解决办法:
这个实际上是vscode 的问题,vscode的终端默认是cmd的形式,这个时候就按照代码提示conda init <SHELL_NAME>,输入

conda init powershell

如果不成功,那么说明你的终端默认是powershell,输入

conda init cmd.exe

就可以解决问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值