无法解析 'requests'。此模块可能缺少 IntelliSense。视觉 Studio/Python

Unable to resolve 'requests'. IntelliSense may be missing for this module. Visual Studio/Python

将 Visual Studio 与 Python 结合使用。我在导入请求时收到此警告。

Unable to resolve 'requests'. IntelliSense may be missing for this module.

在 Python 环境选项卡中,您可以看到我的包中安装了请求。

我想在使用 'requests' 时使用 IntelliSense。我可能忽略了什么吗?

1.Maybe 类似于 this issue。删除项目 top-level 中的 init.py 可以帮助解决此问题。

2.If 以上没有帮助,请尝试重新加载项目

经过我的测试,有时在 python 应用程序中,我们第一次安装 python 包后, intellisense 用于新包在我们重新加载项目文件以识别新包之前,当前项目将无法工作。

对于这种情况,简单的解决方法是:在Solution Explorer=>选择Right-click the project=>再次选择unload the project=>Right-click然后choose reload the project。那么新包的智能感知就可以正常工作了。

希望对您有所帮助,抱歉耽搁了!