You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code中无法运行Python脚本求助:conda命令未被识别

解决VS Code中conda命令无法识别的问题

报错信息

conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • conda activate base
    • CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

核心原因

VS Code的终端没加载conda的环境变量,其他IDE一般会自动配置好conda路径。

解决方法

  • 确认conda安装路径
    找到你的conda安装目录(通常是C:\Users\[你的用户名]\anaconda3或C:\Users\[你的用户名]\miniconda3),进入Scripts文件夹,确认里面有conda.exe文件。

  • 手动添加环境变量

    1. 右键「此电脑」→「属性」→「高级系统设置」→「环境变量」
    2. 在系统变量的Path里添加两个路径:
      • [conda安装目录]\Scripts
      • [conda安装目录]\Library\bin
    3. 保存后重启VS Code。
  • 让VS Code终端自动加载conda

    1. 打开VS Code设置(快捷键Ctrl+,)
    2. 搜索terminal.integrated.shellArgs.windows(Windows系统),其他系统对应搜索关键词
    3. 将值设置为["/K", "C:\Users\[你的用户名]\anaconda3\Scripts\activate.bat"],替换成自己的conda实际路径
    4. 重启终端,此时会自动激活base环境,直接用conda命令就行。
  • 临时应急方案
    直接用conda的完整路径执行命令,示例:

    C:\Users\[你的用户名]\anaconda3\Scripts\conda.exe activate base
    

内容的提问来源于stack exchange,提问作者Zakaria Ait Yakoub

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 10:59:59