web123456

No module named 'bs4' appears after installing Beautiful Soup in Python

This article is mainly used to solve the successful installation of beautiful soup in the terminal, but the following error still occurs in IDLE:

>>>from bs4 import BeautifulSoup

Traceback (most recent call last):

     File "<pyshell #1>",line 1,in <module>

          from bs4 import BeautifulSoup

ImportError: No module named 'bs4'


One of the reasons for this error (there are many error reasons) is that the sudo pip installed beautifulsoup4 entered in the terminal, the bs4 package that was successfully installed is under the Python 2.7 path. The Python in the IDLE of the edit code is version 3.5.2.

So, just change the command to the following:

     sudo pip3 install beautifulsoup4


Of course, there may be other reasons, and the above errors may occur. Please refer to other information.