赞
踩
对于需要在命令行传参运行的项目,如果想要调试运行,则需要编写对应的launch.json文件这里记录一下json文件的编写格式:
- {
- "version": "0.2.0",
- "configurations": [
- {
- "python": "/data/xxx/miniconda3/envs/Program_xxx/bin/python", // 指定python解释器,一般不用写
- "name": "Python: train", // 设定的config名字,用于在debug时选择
- "type": "python",
- "request": "launch",
- "program": "./train.py", // 指定运行的项目,默认为${file},即当前文件
- //"module": "scripts.run_texture", // -m module_name模式,program、module、code中要设定一个
- "console": "integratedTerminal",
- "env": {"CUDA_VISIBLE_DEVICES":"0,1"}, // 指定显卡
- "args": [
- "--config_dir", "configs/car.yaml", // 命令行参数
- "--exp_dir", "exp",
-
- ],
- "justMyCode": true // false调试封装包里面的代码,true只调试自己编写的代码
- }
- ]
- }

这里主要区分在于记载模块化运行的情况,即使用python -m module_name运行的情况,需要填写“module”这一参数,而不是在“args”中写“-m”
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。