VScode Python no module的解决方法

解决方法

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

{
            "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"
            ]
        },

 

posted @ 2019-07-01 14:57  andy_0212  阅读(2689)  评论(1编辑  收藏  举报