简体   繁体   English

报告MissingImports Python 错误但导入工作正常

[英]reportMissingImports Python error but import works fine

When I install package with python and import it, I often get a missing imports message such as:当我使用 python 安装 package 并导入它时,我经常收到缺少导入消息,例如:

Import "fastapi" could not be resolvedPylancereportMissingImports导入“fastapi”无法解决PylancereportMissingImports

The imports always work perfectly fine, the fastapi example above will run a server and I can build an API without issue.导入总是很好,上面的 fastapi 示例将运行服务器,我可以毫无问题地构建 API。

Can anyone explain why I am getting this error and how I could get rid of it?谁能解释我为什么会收到此错误以及如何摆脱它?

Reinstall fastapi again separately.单独重新安装 fastapi。

pip install 'fastapi[all]' pip 安装'fastapi[all]'

pip install fastapi
pip install uvicorn

暂无
暂无

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

相关问题 使用virtualenv Python导入错误,但是iPython可以正常工作 - Import error with virtualenv Python but iPython works fine 在Atom中为Python-Pandas导入模块错误(在CLI中可以正常工作???) - Import Module Error for Python-Pandas in Atom (works fine in CLI???) Python模块导入错误(在Linux上工作正常,但在FreeBSD中失败) - Python module import error (Works fine in linux but fails in FreeBSD) 在 Mac 上的 VSCode 中无法解决导入“pygame”的 Pylance (reportMissingImports) 错误 - Import "pygame" could not be resolved Pylance (reportMissingImports) error in VSCode on mac Pylint“无法导入”错误,但可以正常使用 Pycharm - Pylint "unable to import" error but works fine with Pycharm Python IDLE无法导入脚本(产生错误),但脚本可以从textwrangler正常工作 - Python IDLE won't import script (gives error) but script works fine from textwrangler SSHTunnelForwarder在命令行python中工作正常但在Apache WSGI应用程序中引发了导入错误 - SSHTunnelForwarder works fine in command line python but raised import error in Apache WSGI application 运行“ ./script”会在导入语句后获得语法错误,但“ python脚本”可以正常工作 - running “./script” gets syntax error after import statements, but “python script” works fine Python 3中的导入错误,但可用于Python 2 - Import error in Python 3 but works with Python 2 Cython:数学表达式错误(在 Python 中工作正常) - Cython: Error in math expression (works fine in Python)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM