简体   繁体   English

Pylance 无法识别新安装的 pip 包

[英]Pylance does not recognise newly installed pip packages

I am getting the following error while trying to import newly installed packages from pip:尝试从 pip 导入新安装的软件包时出现以下错误:

Import "<package>" could not be resolved Pylance(reportMissingImports)无法解析导入“<package>”Pylance(reportMissingImports)

After I restart VS code, Pylance seems to then be able to recognise the package.在我重新启动 VS 代码后,Pylance 似乎能够识别 package。

Is there any fix to this as it is very annoying!有没有办法解决这个问题,因为它很烦人!

This question will happen when Pylance doesn't detect the module immediately.当 Pylance 没有立即检测到模块时,就会出现这个问题。 You may Reload Window from Command Palette to refresh the current project.您可以从 Command Palette 中Reload Window来刷新当前项目。

If you are using VS Code, open the command pallet and run "Python: Restart Language Server"如果您使用的是 VS Code,请打开命令托盘并运行“Python:重新启动语言服务器”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM