VScode file not found 等无法引用本地包问题

在使用VScode编程或者Debug时,会遇到本地头文件加载失败等问题。解决方案如下: 

在lauch.json中,修改 "env": {}为 "env": {"PYTHONPATH":"${workspaceRoot}"}

如下: 

{
    // 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: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "env": {"PYTHONPATH":"${workspaceRoot}"}
        }
    ]
}

VScode file not found 等无法引用本地包问题_第1张图片

launch.json 在点击debug模式下的红色位置按钮时显示,如上图

你可能感兴趣的:(疑难问题)