Tag Archives: ModuleNotFoundError: No module named ‘bs4’

After installing BS4 in Python, pychar still reports module not found error: no module named ‘BS4’

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

When learning web crawling, there is a problem in the first step

Executing sample code

from urllib.request import urlopen

from bs4 import BeautifulSoup

html = urlopen(” http://www.pythonscraping.com/exercises/exercise1.html “)

bsObj = BeautifulSoup(html, “html.parser”)

print(bsObj.h1)

Implementation results

Traceback (most recent call last):

File “D:/install/Python_ web Scraping/chapter1/BeautifulSoup.py”, line 2, in < module> from bs4 import BeautifulSoup ModuleNotFoundError: No module named ‘bs4’

Note: beautiful soup has been successfully installed in the terminal, but it still appears in idle

Solutions

1. In pychar Python file options, select the settings option and click in

2. Then select project interpreter

3. Double click pip

4. Search BS4, click Install, and the message of successful installation will be prompted