简体   繁体   English

无法在python中导入beautifulsoup

[英]Unable to import beautifulsoup in python

I'm using Python.7.10 and have installed beautifulsoup using pip. 我正在使用Python.7.10并使用pip安装了beautifulsoup。 The package was installed successfully. 该软件包已成功安装。 But when I'm trying to import beautifulsoup, I'm getting this error: 但是当我尝试导入beautifulsoup时,我收到了这个错误:

ImportError: No module named beautifulsoup

I checked the list of my installed modules and I found the beautifulsoup module in the installed modules list: 我查看了已安装模块的列表,并在已安装的模块列表中找到了beautifulsoup模块:

美丽的汤安装图片

导入时出错

已安装的模块列表

You installed BeautifulSoup version 3; 你安装了BeautifulSoup版本3; the module is called BeautifulSoup with capital B and S : 该模块名为BeautifulSoup ,大写为BS

from BeautifulSoup import BeautifulSoup

See the Quickstart documentation . 请参阅快速入门文档

You really want to upgrade to BeautifulSoup 4. BeautifulSoup 3 was discontinued in 2012. 你真的想升级到BeautifulSoup 4. BeautifulSoup 3于2012年停产。

To install version 4, use: 要安装版本4,请使用:

pip install beautifulsoup4

and import bs4 : 并导入bs4

from bs4 import BeautifulSoup

Do study the project documentation before continuing however. 在继续之前,请先研究项目文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM