我正在使用 Python.7.10 并使用 pip 安装了 beautifulsoup。软件包安装成功。但是当我尝试导入 beautifulsoup 时,出现了这个错误:
ImportError: No module named beautifulsoup
我检查了我安装的模块列表,我在安装的模块列表中找到了 beautifulsoup 模块:
最佳答案
您安装了 BeautifulSoup 版本 3;该模块名为 BeautifulSoup
,大写 B
和 S
:
from BeautifulSoup import BeautifulSoup
你真的想升级到 BeautifulSoup 4。BeautifulSoup 3 已于 2012 年停产。
要安装版本 4,请使用:
pip install beautifulsoup4
并导入bs4
:
from bs4 import BeautifulSoup
研究 project documentation然而,在继续之前。
关于python - 无法在python中导入beautifulsoup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35426701/