vscode python debug launch.json 模板

526 阅读1分钟
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: assign a python file", 
            "type": "debugpy",
            "request": "launch",
            // "program": "${file}", // Current File 指在点 debug 键时打开的文件
            "program": "dir_path/tools/train.py", // 固定到具体文件就可以随时随地 debug 啦
            "console": "integratedTerminal",
            "args": [ // 命令行启动时的参数写到这里
                "-y", "None",
                "--model_dir", "/home/xxx"
            ],
            "python": "/home/username/.conda/envs/conda_name/bin/python3.8", // conda 环境对应的 python
            "env": {"CUDA_VISIBLE_DEVICES":"7"}, // 指定显卡
            // "cwd": "system"
        }
    ]
}