vscode debug 配置:launch.json

打开新项目左边的"运行和调试"

点击蓝色字体"创建 launch.json 文件"

选择上方"python"

选择"Python 文件 调试当前正在运行的Python文件"

配置launch.json文件内容:

json 复制代码
{
   // 使用 IntelliSense 了解相关属性
   // 悬停以查看现有属性的描述。
   // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
   "version": "0.2.0",
   "configurations": [                
       {
           "name": "Python: Current File",
           "type": "python",
           "request": "launch",
           "program": "${file}",
           "console": "integratedTerminal",
           "justMyCode": true,
           "env": {"PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT": "2"},
           "cwd": "${fileDirname}",
           "args": ["./configs/xxx.yaml",
           			"--a", "A",
           			"--b", "B"
           ]         
       }
   ]
}

"justMyCode": true debug时只进入项目自带文件,不进入安装的包文件
"env": {"PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT": "2"} 多长时间显示 pydevd warnings
"cwd": "${fileDirname}" 控制代码的初始路径为debug文件所在路径
"args": ["xxx", "xxx"] debug时传入的参数

相关推荐
Robot_Nav13 小时前
AI 编程助手 Skill 完全指南:VS Code · Trae CN · Claude Code
人工智能·vscode·skill·trae·claude code
生而为虫17 小时前
在VScode中使用Claude Code agent并配置模型(仅mac电脑实际操作,windows电脑未实际操作如有问题可留言)
windows·vscode·macos
千码君20162 天前
flutter: 分享一下基于trae cn 构建的过程
java·vscode·flutter·kotlin·trae
我才是一卓2 天前
2026 Python 入门教程,结合 vscode 和 miniforge/miniconda
开发语言·vscode·python
lzl20402 天前
VSCode中Codex CLI登录卡在‘Sign in with ChatGPT‘屏幕
ide·vscode·chatgpt·codex
SkyXZ~2 天前
Mac上使用VScode优雅开发STM32
vscode·stm32·macos
xskukuku2 天前
VSCode中的Codex插件如何调用第三方API
vscode·ai·codex
lijfrank2 天前
MacOS 下 VS Code + LaTeX + Skim 双向同步配置
vscode·macos·pdf·latex·mactex
AI进化营-智能译站2 天前
Jazzy ROS2入门指南系列05-配置VsCode实现ROS2项目开发
ide·vscode·ai·编辑器
时光之源3 天前
Visual Studio | Marketplace创建发布者(Create Publisher)时无法创建的问题解决方案
ide·vscode·visual studio·plugin·cursor