问题
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:
回答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