VScode Python no module的解决方法

2020-09-17 10:17:54 浏览数 (1)

在lauch.json中,修改 "env": {}为 "env": {"PYTHONPATH":"${workspaceRoot}"} 完整的代码如下:

代码语言:javascript复制
{
            "name": "Python",
            "type": "python",
            "request": "launch",
            "stopOnEntry": false,
            "pythonPath": "${config:python.pythonPath}",
            "program": "${file}",
            "cwd": "${workspaceRoot}",
            "env": {"PYTHONPATH":"${workspaceRoot}"},
            "envFile": "${workspaceRoot}/.env",
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit",
                "RedirectOutput"
            ]
}

0 人点赞