有关用于设置Python调试的VSCode的问题

时间:2018-12-12 02:27:56

标签: python visual-studio-code

vs代码版本:1.29.1(1.29.1)

python版本:3.6.5


Launch.json:

     {
        "name": "Python",
        "type": "python",
        "pythonPath":"${config.python.pythonPath}", 
        "request": "launch",
        "stopOnEntry": true,
        "console": "none",
        "program": "${file}",
        "cwd": "${workspaceRoot}",
        "debugOptions": [
            "WaitOnAbnormalExit",
            "WaitOnNormalExit",
            "RedirectOutput"
        ],
        "env": {"name":"value"}
    }

工作区设置:

     {
"python.pythonPath": "/usr/local/opt/python/libexec/bin/python",
"python.linting.pylintEnabled": true
     }

Extensions I downloaded.


当我测试调试时,我失败了。

result


说“开始调试之前,您需要选择一个Python解释器”。 但是我实际上选择了一个显示在左下角的版本。

任何部分不正确吗?

2 个答案:

答案 0 :(得分:1)

我将其编辑为以下代码,并且可以正常工作!

{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"stopOnEntry": true
}

答案 1 :(得分:0)

VS Code网站上此处给出的文档可能会有所帮助。您是否尝试过从这里获取参考? https://code.visualstudio.com/docs/python/debugging