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直接运行,而不用再打开要运行的文件了。

posted @   思wu邪  阅读(2712)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10亿数据,如何做迁移?
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 易语言 —— 开山篇
· Trae初体验
点击右上角即可分享
微信分享提示