Unable to import beautifulsoup in python

我怕爱的太早我们不能终老 提交于 2020-12-30 02:32:47

问题


I'm using Python.7.10 and have installed beautifulsoup using pip. The package was installed successfully. But when I'm trying to import beautifulsoup, I'm getting this error:

ImportError: No module named beautifulsoup

I checked the list of my installed modules and I found the beautifulsoup module in the installed modules list:

Beautiful soup Installed Picture

Error while importing

Installed module list


回答1:


You installed BeautifulSoup version 3; the module is called BeautifulSoup with capital B and S:

from BeautifulSoup import BeautifulSoup

See the Quickstart documentation.

You really want to upgrade to BeautifulSoup 4. BeautifulSoup 3 was discontinued in 2012.

To install version 4, use:

pip install beautifulsoup4

and import bs4:

from bs4 import BeautifulSoup

Do study the project documentation before continuing however.



来源:https://stackoverflow.com/questions/35426701/unable-to-import-beautifulsoup-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!