Importerror: no module named BS4 error resolution

Preface: Graduation thesis plans to use Python as a crawler to crawl some data, and recently started to get started with Python;

I encountered a problem while studying. I installed Python according to the article I read, and configured the corresponding environment (using the window system), and used the pycharm editor to write Python (this software is very convenient to run Python, and install the libraries needed for Python. It’s also very simple).

After installing the requests and BeautifulSoup libraries, I started to crawl a local html. At the beginning, I quoted from bs4 import BeautifulSoup, but I kept reporting ImportError: No module named bs4 at the end ;

 

After checking some information, the problem was solved smoothly;

Solution:

An ImportError: No module named bs4error is displayed during runtime , meaning that the module named Beautifulsoup4 was not found.

Write about how Python installs modules:

1. Download the BS4 module:

http:/ /www.crummy.com/software /BeautifulSoup/bs4/download/ 4.3/beautifulsoup4- 4.3. 2.tar.gz

2. Unzip it to the root directory under the Python installation directory:

3. Run cmd and enter the decompressed directory (if Python is installed in the C drive by default, after opening cmd, you can use the cd … statement to return to the root directory first, and then enter Python27\beautifulsoup4-4.3.2 )

4. After entering Python27\beautifulsoup4-4.3.2 , install the BS4 module:

 

It can be used after installation;  

 

 

Similar Posts: