python - 无法在python中导入beautifulsoup

标签 python python-2.7 beautifulsoup python-module

我正在使用 Python.7.10 并使用 pip 安装了 beautifulsoup。软件包安装成功。但是当我尝试导入 beautifulsoup 时,出现了这个错误:

ImportError: No module named beautifulsoup

我检查了我安装的模块列表,我在安装的模块列表中找到了 beautifulsoup 模块:

Beautiful soup Installed Picture

Error while importing

Installed module list

最佳答案

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

from BeautifulSoup import BeautifulSoup

参见 Quickstart documentation .

你真的想升级到 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/

相关文章:

python - 使用pyaudio时什么是 block 、样本和帧

python - matplotlib.pyplot.plotfile() - 如何将多个图形绘制到同一个图形中?

python-2.7 - 找不到 Pyinstaller GLIBC_2.15

python - 为什么这个 python 代码不替换已删除的列表元素?

python - 大型门户网站上的 web2py 或 grok(zope),

python-2.7 - 如何在Python中将所有对象添加到空列表中?

python - 在不使用 np.tile() 或创建新向量的情况下将向量扩展 n 次以适应更大的矩阵

python - 在 python 中使用 SSL 证书访问 protected 网站

python - BeautifulSoup 网址抓取

Python - BeautifulSoup - HTML 解析