VScode Python no module solution

Solution

In lauch.json, modify "env": {} is the "env": { "PYTHONPATH" : "$ {workspaceRoot}"}
full code is as follows:

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

 

Guess you like

Origin www.cnblogs.com/andy-0212/p/11114090.html