vscode带命令行参数进行调试
vscode带命令行参数进行调试

2.输入代码
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
// "env": {"CUDA_VISIBLE_DEVICES":"0,1,2,3"},
"args": [
"--train --config=configs/lane_detection/resa/erfnet_tusimple.py"
]
}
]
}
上述程序带的命令行参数:--train --config=configs/lane_detection/resa/erfnet_tusimple.py
启动的方式就是:首先打开你要运行的文件,然后点击即可

参考:【记录】使用VScode进行远程命令行指定参数调试方法,python -m_洪城布衣的博客-CSDN博客_vscode 命令行调试
2022-5-13 08:30:28 :对上述launch.json
编写的方式现在换了个新的:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// python main_landet.py --train --config=configs/lane_detection/resa/erfnet_tusimple.py
"name": "Train_erfnet_tusimple",
"type": "python",
"request": "launch",
"program": "main_landet.py",
"args": [
"--train",
"--config=configs/lane_detection/resa/erfnet_tusimple.py"
],
"console": "internalConsole",
"justMyCode": true
},
{
// python main_landet.py --test --config=configs/lane_detection/resa/erfnet_tusimple.py
"name": "Test_erfnet_tusimple",
"type": "python",
"request": "launch",
"program": "main_landet.py",
"args": [
"--test",
"--config=configs/lane_detection/resa/erfnet_tusimple.py"
],
"console": "internalConsole",
"justMyCode": true
},
]
}
json
文件里面指定了运行哪个文件,可以按F5直接运行,而不用再打开要运行的文件了。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10亿数据,如何做迁移?
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 易语言 —— 开山篇
· Trae初体验