gpt4 book ai didi

python - 找不到模块 beautifulsoup

转载 作者:行者123 更新时间:2023-12-01 04:24:59 29 4
gpt4 key购买 nike

我是Python初学者,有一个项目,其中需要BeautifulSoup。在代码中它的引用如下:

 from bs4 import BeautifulSoup

尽管我使用 PyCharm 安装了 BeeatifulSoup,我收到此错误:

 ImportError: No module named bs4

当我将其更改为:

from BeautifulSoup import BeautifulSoup

我在使用 BeautifulSoup 对象时收到此错误:

links = soupObject.find_all("a")
TypeError: 'NoneType' object is not callable

当我简单地更改为:

 import BeautifulSoup

我收到此错误:

soup = BeautifulSoup(param)
TypeError: 'module' object is not callable

我真的不知道为什么这段代码在我的机器上不起作用?我该如何解决它?谢谢

最佳答案

当您在 PyCharm 中搜索可用的软件包以安装到您的环境中并查找 beautifulsoup 时,请务必安装 beautifulsoup4 而不是 BeautifulSoup code> 如果您的要求是使用 v4+。

关于python - 找不到模块 beautifulsoup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33258642/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com