vscode带命令行参数进行调试
1
2.输入代码
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: 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
启动的方式就是:首先打开你要运行的文件,然后点击即可
2022-5-13 08:30:28 :对上述launch.json编写的方式现在换了个新的:
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: 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直接运行,而不用再打开要运行的文件了。