简体   繁体   English

无法从 sourcePylancereportMissingModuleSource 解析导入“urllib3”

[英]Import "urllib3" could not be resolved from sourcePylancereportMissingModuleSource

I am new to Python and writing a lambda function.我是 Python 新手,正在编写一个 lambda 函数。 I installed urllib3 using pip but still getting this following error.我使用 pip 安装了 urllib3,但仍然出现以下错误。

在此处输入图像描述

I tried restarting vscode/ uninstall and reinstall but still getting the error.我尝试重新启动 vscode/卸载并重新安装,但仍然出现错误。

this is the result when I run pip show urllib3这是我运行 pip show urllib3 时的结果

在此处输入图像描述

what am i missing here?我在这里想念什么?

Maybe there is more than one python environment on your machine, And the location where you installed the package is inconsistent with the python interpreter you are using now.可能你机器上的python环境不止一个,而且你安装包的位置和你现在使用的python解释器不一致。

You can use CTRL + SHIFT + P to open the command palette and search Python: Select Interpreter (or click on the interpreter version displayed in the lower right corner).您可以使用CTRL + SHIFT + P打开命令面板并搜索Python:选择 Interpreter (或单击右下角显示的解释器版本)。

在此处输入图像描述

Select the environment interpreter where you have the urllib3 package installed.选择安装了urllib3包的环境解释器。

You need to make sure that VS Code uses the same Python Interpreter that you installed this package to.您需要确保 VS Code 使用与您安装此包相同的 Python 解释器。

You can see it here:在这里你可以看到它:

在此处输入图像描述

Looks like yours should point to看起来你的应该指向

c:\user\###\appdata\local\programs\python\python39\bin\python

(or something like that, where your python executable file is located) (或类似的东西,你的python可执行文件所在的位置)

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

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