每当我尝试在 VS Code 中导入 matplotlib 或 matplotlib.pyplot 时,我都会在标题中收到错误:
Import "matplotlib" could not be resolved from source Pylance(reportMissingModuleSource)
Run Code Online (Sandbox Code Playgroud)
或者
Import "matplotlib.pyplot" could not be resolved from source Pylance(reportMissingModuleSource)
Run Code Online (Sandbox Code Playgroud)
reportMissingModuleSource 的超链接将我发送到https://github.com/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md#diagnostic-severity-rules,其中显示:
“诊断没有相应源文件的导入当找到类型存根,但未找到模块源文件时,会发生这种情况,表明使用此执行环境时,代码可能会在运行时失败。类型检查将使用类型存根进行。
但是,从解释中我不明白到底出了什么问题以及我应该做什么来解决这个问题,有人可以帮助我吗?