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

 

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

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

 

 

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

 

 

解决:

在settings.json文件中添加:

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

 

"python.analysis.extraPaths": [
    "./src",        // 自定义模块的相对路径,可多个,可绝对路径  
    "./modules"
]

 

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-18
  • 2022-12-23
  • 2022-01-08
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案