VS Code Python 当import自定义module时 报错 "could not be resolved"

在VS Code中编写python文件时,import自定义module报错 "could not be resolved"。

Import "[module]" could not be resolvedPylance (reportMissingImports) 

https://github.com/microsoft/pylance-release/blob/master/TROUBLESHOOTING.md#unresolved-import-warnings

解决:

在settings.json文件中添加:

"python.analysis.extraPaths": [
    "./src",        // 自定义模块的相对路径,可多个,可绝对路径  
    "./modules"
]
原文地址:https://www.cnblogs.com/cralor/p/14090126.html