1.问题
我在命令行运行的是python render.py -m LangSplat/preprocessed_dataset/sofa/sofa --include_feature -l luage_features_1080p_dim3,但是在vscode中的普通调试,会报模块找不到的问题(原因是普通调试不会带-m参数,所以有些路径就会找不到)。因此,本文记录如何用vscode调试在命令行输入的如上Python指令。
2.解决方案
# 先按照这个module
pip install debugpy
# 在命令行运行:
python -m debugpy --listen 5678 --wait-for-client render.py -m LangSplat/preprocessed_dataset/sofa/sofa --include_feature -l luage_features_1080p_dim3
而后在VSCode中,点击:上方菜单栏->debug->Open Configurations,修改内容为如下:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
}
}
]
}
3.调试
在vscode中按下F5,debug的快捷键(记得提前设置断点),就可以进行代码调试