Skip to main content
 首页 » 编程设计

python之关于VSCode设置Python调试的一个问题

2024年12月31日9over140

vs代码版本:1.29.1(1.29.1)

python 版本:3.6.5


启动.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解释器”。 但我实际上选择了一个版本显示在左下角。

哪里不对?

请您参考如下方法:

我按照下面的代码进行编辑,它有效!!

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