在Vscode中未能使用python的urllib.request。

发布于 2025-01-26 15:48:43 字数 534 浏览 2 评论 0原文

我试图在VSCODE中导入urllib.request wth python,但一直收到消息:InvimperRor:无模块命名请求。我只是进口Urllib没有问题,我知道这是Python2的正确行。我确定我正在使用Python3,因为这就是我在解释器路径中选择的。

这是屏幕截图:

我还将pip3 install urllib3放在终端中,并收到此消息,这意味着python3应该拥有它:

需求已经满足:urllib3 in/library/frameworks/python.frameworks/python.framework/versions/3.8/lib /Python3.8/site-packages(1.26.9)

有什么想法出了什么问题或不是Python版本的问题?

I tried to import urllib.request wth python in vscode but kept getting the message: ImportError: No module named request. I have no problem importing just urllib, which I know is the right line for python2. I'm sure I'm using python3 as that's what I've selected in the interpreter path.

Here's the screenshot:
enter image description here

I've also put pip3 install urllib3 in the terminal and got this message which means python3 should have it:

Requirement already satisfied: urllib3 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.26.9)

any idea what have gone wrong or it's not the problem with python version?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彡翼 2025-02-02 15:48:43

这与您的多个环境有关。使用PIP安装软件包时,应指定安装路径。

pip install -t flodername urllib3 #the package of the python interpreter you chosen

This is related to your multiple environments. You should specify the installation path when using pip installation package.

pip install -t flodername urllib3 #the package of the python interpreter you chosen
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文