-->

vscode带命令行参数进行调试

2.输入代码

{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://www.sxzhongrui.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_www.sxzhongrui.com"
] }
]
}

上述程序带的命令行参数:--train --config=configs/lane_detection/resa/erfnet_www.sxzhongrui.com

启动的方式就是:首先打开你要运行的文件,然后点击即可

参考:【记录】使用VScode进行远程命令行指定参数调试方法,python -m_洪城布衣的博客-CSDN博客_vscode 命令行调试


2022-5-13 08:30:28 :对上述launch.json编写的方式现在换了个新的:

{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://www.sxzhongrui.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// python main_www.sxzhongrui.com --train --config=configs/lane_detection/resa/erfnet_www.sxzhongrui.com
"name": "Train_erfnet_tusimple",
"type": "python",
"request": "launch",
"program": "main_www.sxzhongrui.com",
"args": [
"--train",
"--config=configs/lane_detection/resa/erfnet_www.sxzhongrui.com"
],
"console": "internalConsole",
"justMyCode": true
},
{
// python main_www.sxzhongrui.com --test --config=configs/lane_detection/resa/erfnet_www.sxzhongrui.com
"name": "Test_erfnet_tusimple",
"type": "python",
"request": "launch",
"program": "main_www.sxzhongrui.com",
"args": [
"--test",
"--config=configs/lane_detection/resa/erfnet_www.sxzhongrui.com"
],
"console": "internalConsole",
"justMyCode": true
},
]
}

json文件里面指定了运行哪个文件,可以按F5直接运行,而不用再打开要运行的文件了。

-->