【问题标题】:Errors when setting up Shell Launcher Extension for VSCode with Anaconda Prompt and Git Bash使用 Anaconda Prompt 和 Git Bash 为 VSCode 设置 Shell Launcher Extension 时出错
【发布时间】:2023-03-30 22:48:01
【问题描述】:

我无法让 anaconda 提示与 VSCode shell 启动器一起使用。

我正在尝试为 VSCode 设置 Shell Launcher Extension 以在 Windows 10 上运行以下终端: 吉特巴什, 指令, 电源外壳, 蟒蛇提示

我已经配置了我的设置。 json 代码如下:

 {  
  "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
  "shellLauncher.shells.windows": [
    {
      "shell": "C:\\Program Files\\Git\\bin\\bash.exe",
      "args": [],
      "label": "bash"
    },
    {
      "shell": "cmd",
      "args": [],
      "label": "cmd"
    },
    {
      "shell": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
      "args": [],
      "label": "PowerShell"
    },
    {
      "shell": "cmd",
      "args": [
        "/K",
        "C:\\ProgramData\\Anaconda3\\Scripts\\activate.bat C:\\ProgramData\\Anaconda3"
      ],
      "label": "Conda"
    }
  ]
}

如您所见,Bash 是我的默认终端,它使用 ctrl+` 打开,我的 shell 启动器使用 ctrl+shift+t 打开。

Shell 启动器列出了我上面的所有条目,所有终端都通过 Shell Launcher 启动,除了 Anaconda Prompt。

据我了解,根据这篇博文:How to Add Anaconda Prompt to VSCode Integrated Terminal, Anaconda Prompt 扩展了 windows cmd,我只需要传入运行脚本的参数即可。

我从 Anaconda 菜单的属性中提取了 args,但是当我尝试启动 anaconda 提示符时,我收到以下错误消息:

终端进程命令 'cmd /K 'C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3'' 启动失败(退出代码:2)

这里是正常工作的anaconda提示桌面图标的属性菜单路径。

%windir%\System32\cmd.exe "/K" C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3

我已尝试将 cmd 的实际路径添加为:

%windir%\\System32\\cmd.exe

,但这只是从 Shell Launcher 下拉菜单中完全删除 Anaconda 提示符。

我该如何解决这个问题?

任何帮助将不胜感激。 :)

【问题讨论】:

    标签: json shell cmd visual-studio-code anaconda


    【解决方案1】:

    我修好了。 “cmd.exe”是有效的路径。

    对于想要在 Windows 10 的 VScode 中设置多个集成终端的其他人,这里是我正在使用的 Shell Launcher 扩展的设置。

    这会将我的默认终端设置为 Git Bash,并允许我使用 Shell Launcher 打开 bash、cmd、Anaconda 提示符和 powershell。

      "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
      "shellLauncher.shells.windows": [
        {
          "shell": "C:\\Program Files\\Git\\bin\\bash.exe",
          "args": [],
          "label": "bash"
        },
        {
          "shell": "cmd.exe",
          "args": [],
          "label": "cmd"
        },
        {
          "shell": "cmd.exe",
          "args": [
            "/K",
            "C:\\ProgramData\\Anaconda3\\Scripts\\activate C:\\ProgramData\\Anaconda3"
          ],
          "label": "Conda"
        },
        {
          "shell": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
          "args": [],
          "label": "PowerShell"
        }
      ]
    

    快乐黑客。 ;)

    【讨论】:

      猜你喜欢
      • 2018-10-30
      • 2018-04-17
      • 2021-01-18
      • 1970-01-01
      • 2018-08-08
      • 2021-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多