如何配置 VS Code 使用 Cmder?

问题描述

我使用 VS code 作为 IDE(anaconda 环境)的 Python。因此,我将 cmder 配置为我的终端,并尝试通过单击运行按钮(绿色三角形)来测试一个简单的 print 语句。我收到以下错误

enter image description here

我的 JSON 设置如下所示:

   {
    "terminal.integrated.shell.windows": "Cmder.exe","terminal.integrated.env.windows": {
        "CMDER_ROOT": "C:\\Users\\EK\\Cmder.exe"
    },"terminal.integrated.shellArgs.windows": [
        "/k","%CMDER_ROOT%\\vendor\\bin\\vscode_init.Cmder"
    ],"python.pythonPath": "C:\\ProgramData\\Anaconda3\\python.exe","atomKeymap.promptV3Features": true,"editor.multiCursorModifier": "ctrlCmd","editor.formatOnPaste": true,"kite.showWelcomeNotificationOnStartup": false,"workbench.colorCustomizations": {
        "terminal.background": "#1D2021","terminal.foreground": "#09c0f8","terminalCursor.background": "#A89984","terminalCursor.foreground": "#A89984","terminal.ansiBlack": "#1D2021","terminal.ansiBlue": "#0D6678","terminal.ansiBrightBlack": "#665C54","terminal.ansiBrightBlue": "#0D6678","terminal.ansiBrightCyan": "#8BA59B","terminal.ansiBrightGreen": "#95C085","terminal.ansiBrightmagenta": "#8F4673","terminal.ansiBrightRed": "#FB543F","terminal.ansiBrightWhite": "#FDF4C1","terminal.ansiBrightYellow": "#FAC03B","terminal.ansiCyan": "#fbfdfc","terminal.ansiGreen": "#95C085","terminal.ansimagenta": "#8F4673","terminal.ansiRed": "#FB543F","terminal.ansiWhite": "#A89984","terminal.ansiYellow": "#FAC03B"
    },"workbench.colorTheme": "Monokai Dimmed","workbench.editor.decorations.colors": true,"workbench.preferredHighContrastColorTheme": "Visual Studio Light","python.formatting.provider": "none","terminal.integrated.automationShell.linux": "","terminal.integrated.scrollback": 100000,"workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb","filenamePattern": "*.ipynb"
        }
    ],"terminal.integrated.env.windows": {}
}

我不知道为什么事情会出错?有人可以帮我解决这个问题吗?

解决方法

请找到“cmder”可执行文件的绝对路径,并在“settings.json”中使用此路径:

enter image description here

"settings.json":

"terminal.integrated.shell.windows": "..:\\cmder\\Cmder.exe",

运行:

enter image description here

另外,请检查是否可以在 VS Code 之外使用“cmder”终端。

参考:Integrated Terminal in VS Code