【问题标题】:Debugging not working in Visual Studio Code with Python使用 Python 在 Visual Studio Code 中调试不起作用
【发布时间】:2018-10-21 23:18:55
【问题描述】:

我对 python 还很陌生,到目前为止,我一直在使用 Komodo 作为我的解释器。我决定尝试一些更强大的东西,所以我安装了 Visual Studio Code 版本 1.23.1 并且我正在运行 Python 3.6.4。当我运行一个基本脚本时,它运行正常,但我注意到在调试器窗口中没有出现任何变量,实际上什么也没有出现。不知道我做错了什么。调试设置为 DEBUE Python: Current File。

【问题讨论】:

    标签: python python-3.x visual-studio-code


    【解决方案1】:

    默认情况下,VSCode 的调试器将执行您的文件,直到遇到断点(或异常)或您的程序退出。要更改此行为,请将 "stopOnEntry": true 设置为您的 launch.json 配置,如下所示:

    "configurations": [
            {
                "name": "Python: Current File",
                "type": "python",
                "request": "launch",
                "program": "${file}",
                // Add this line
                "stopOnEntry": true
            },
            // other configurations
            ...
    }
    

    【讨论】:

    • 好的,谢谢!我会做出这个改变,看看效果如何。
    • 当我点击 F1 > Debug open launch.json > Select Environment - 没有 python 选项,但是 node, chrome, edge.. Python 安装在 c:/python 中,在路径和python调试器扩展也是。
    猜你喜欢
    • 2018-07-09
    • 2017-03-19
    • 2021-08-23
    • 1970-01-01
    • 2017-09-15
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 2019-06-27
    相关资源
    最近更新 更多