赞
踩
VSCode中使用自定义模块时,经常会出现找不到模块的问题,如下所示:
Exception has occurred: ModuleNotFoundError
No module named ‘common’
修改.vscode下的launch.json文件,增加env两行代码即可。
{
// 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: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"cwd": "${fileDirname}",
"env":{"PYTHONPATH":"${workspaceRoot}"},
"envFile": "${workspaceFolder}/.env"
}
]
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。