VSCode Python DEBUG 调试

Python VSCode 调试

VSCode Debug

VSCode Python DEBUG 调试

VSCode Python DEBUG 调试
py文件必须是单个的可以执行的,不需调用参数文件
在选中任意一个py文件后,这个选项就会消失
VSCode Python DEBUG 调试
2. 新建Debug的launch file
VSCode Python DEBUG 调试
点击后,出现提示
VSCode Python DEBUG 调试
选择 “Python 文件 调试打开的 Python 文件”
就会生成一个 Launch.json 的文件 在 .vscode 的文件夹下
VSCode Python DEBUG 调试
  • VScode 会在每个项目文件夹下创建一个.vscode文件夹,保存当前项目的运行环境的配置文件。
    VSCode Python DEBUG 调试

查看选择需要的解释器

VSCode Python DEBUG 调试
VSCode Python DEBUG 调试
编辑Launch.json
{

    "version": "0.2.0",
    "configurations": [

        {
                "name": "Python",
                "type": "python",
                "request": "launch",
                "stopOnEntry": false,
                "python": "C:\\Users\\YLwork\\APPData\\Local\\Programs\\Python\\Python38\\python.exe",

                "program": "${file}",
                "cwd": "${workspaceRoot}",
                "console": "integratedTerminal",
                "justMyCode": true,
                "args": ["examples\\benchmarks\\LightGBM\\workflow_config_lightgbm_Alpha158_l1.yaml"],
                "env": {},
                "envFile": "${workspaceRoot}/.env",
                "redirectOutput": true
        }
    ]
}
  • *调试的时候,一定要点开选中要调试的py文件

断点 Breakpoint

直接点击文件左侧,激活断点

VSCode Python DEBUG 调试
; Reference

VSCode中Python的Debug调试配置
记录VSCode调试python一个极傻的坑:显示launch.json中name ‘true’ is not defined

Version

0.0.1 – 2022May6

Original: https://blog.csdn.net/pandoraliu/article/details/124620656
Author: Wuerselen
Title: VSCode Python DEBUG 调试

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/671350/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球