VS代码中的外部终端调试器



由于我无法在调试控制台中给出输入,因此我试图在VS代码中的外部终端中运行调试器。

这是启动的一部分。

{
            "name": "Python: Terminal (external)",
            "type": "python",
            "request": "launch",
            "stopOnEntry": true,
            "pythonPath": "${config:python.pythonPath}",
            "program": "${file}",
            "cwd": "",
            "console": "externalTerminal",
            "env": {},
            "externalConsole": true,
            "envFile": "${workspaceRoot}/.env",
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit"
            ]
},

我在这里所说的那样添加了"externalConsole": true部分,我尝试过有或没有该语句。

我有这个错误,

Debug adapter process has terminated unexpectedly

我在JSON文件中尝试了文档和Intellisense,但我无法理解并使其工作。

"console": "externalTerminal",添加到Debug配置文件上可以在Linux上工作!

我正在使用Windows,但是,这应该解决您的问题。

"name": "Python: Terminal (external)",
        "type": "python",
        "request": "launch",
        "stopOnEntry": true,
        "pythonPath": "C:/Users/Zac/Anaconda3/python.exe",
        "program": "${file}",
        "cwd": "",
        "console": "externalTerminal",
        "env": {},
        "envFile": "${workspaceFolder}/.env",
        "debugOptions": [
            "RedirectOutput"
        ]
    },

您需要在" pythonpath"行中正确添加python.exe位置。

此外,从" debugoptions"中取出" waitonabnormalexit"one_answers" waitonnormalexit",然后只使用" redirectOutput"。从代码中删除" externalConsole":true。

其他一切都应该保持不变。

希望有帮助。欢呼。

还记得要为外部终端位置放置正确的值:

terminal.external.windowsexec

最新更新