无法在python中导入beautifulsoup

2024-10-04 09:24:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的是Python.7.10,并使用pip安装了beautifulsoup。已成功安装程序包。但当我试图导入BeautifulGroup时,我得到了一个错误:

ImportError: No module named beautifulsoup

我查看了已安装模块的列表,在已安装模块列表中找到了BeautifulGroup模块:

Beautiful soup Installed Picture

Error while importing

Installed module list


Tags: 模块pipno列表错误namedmoduleimporterror
1条回答
网友
1楼 · 发布于 2024-10-04 09:24:50

您安装了美化组版本3;该模块名为BeautifulSoup,大写BS

from BeautifulSoup import BeautifulSoup

请参阅Quickstart documentation

你真的想升级到美化组4。美团3号于2012年停产。

要安装版本4,请使用:

pip install beautifulsoup4

并导入bs4

from bs4 import BeautifulSoup

不过,在继续之前,一定要研究project documentation

相关问题 更多 >