VSCode警告 Import “package“ could not be resolved

VSCode警告 Import “package” could not be resolved

Pylance插件报告缺少的引入

VSCode警告 Import “package“ could not be resolved

解决方案

Ctrl+Shift+P打开命令面板,输入settings,选择Preferences: Open Settings(JSON)
VSCode警告 Import “package“ could not be resolved
添加"python.pythonPath": "Your python path",加入python.exe路径
VSCode警告 Import “package“ could not be resolved
保存,重新打开VSCode即可