These extra roots must be specified to the language server. The
easiest way to do this (with the VS Code Python extension) is to
create a workspace configuration which sets
python.analysis.extraPaths. For example, if a project uses a sources
directory, then create a file .vscode / settings.json in the workspace
with the contents:
我发现这个链接告诉我们应该添加一个额外的路径
https://github.com/microsoft/pylance-release/blob/master/TROUBLESHOOTING.md#unresolved-import-warnings
我发现有一样东西解决了我和你的问题
Location:
路径ctrl
+','Add Item
粘贴复制的路径字符串并确定李>我们添加了实际安装路径作为附加导入搜索解析路径,因此将扫描此路径以进行导入
现在你的模块应该被解析了。这对我有用
在VSCODE上解决此问题的另一种简单方法:
ctrl
+','此外,如果您在导入本地文件时遇到问题,您也可以执行相同的操作,并添加工作目录路径以解决问题:)只需以相同的方式在“./sources”之外添加“C:your working directory goes here”。)
相关问题 更多 >
编程相关推荐