【发布时间】:2022-01-14 10:47:15
【问题描述】:
每当我尝试在 VS Code 中导入 matplotlib 或 matplotlib.pyplot 时,标题中都会出现错误:
Import "matplotlib" could not be resolved from source Pylance(reportMissingModuleSource)
或
Import "matplotlib.pyplot" could not be resolved from source Pylance(reportMissingModuleSource)
reportMissingModuleSource 的超链接将我发送到 https://github.com/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md#diagnostic-severity-rules,其中显示:
“诊断没有相应源文件的导入。当找到类型存根但模块源文件时会发生这种情况未找到,说明使用此执行环境时代码可能在运行时失败。类型检查将使用类型存根进行。”
但是,从解释中我不明白到底出了什么问题以及我应该怎么做才能解决这个问题,有人可以帮我解决这个问题吗?
【问题讨论】:
标签: python matplotlib visual-studio-code pylance