VSCode - 如何设置调试的工作目录

VSCode - 如何设置调试的工作目录

具体来说,您可以指定一个动态工作目录。 (即,当前打开的Python文件所在的目录),请使用"cwd": "${fileDirname}"

如果您在运行Python时使用的是Python: Current File (Integrated Terminal)选项,那么您的launch.json文件可能看起来像下面的我的文件。

{
    "version": "0.2.0",
    "configurations": [
    {
            "name": "Python: Current File (Integrated Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "cwd": "${fileDirname}"
    }, 

    //... other settings, but I modified the "Current File" setting above ...
}

 

posted @ 2020-09-15 17:32  空虚的灵魂  阅读(6497)  评论(0)    收藏  举报