Beautifulsop is an open-source library/package for Python. It is used for easy to scrap information from websites.
We are going to install Beautifulsop 4 python library also known as BS4.
Prerequisites
- Installed Python on your system.
- Terminal/commend line access.
Installing Beautifulsop4(BS4)
Follow the bellow steps to complete installing process.
Step 1 : Check the Python Version
Before you can install BS4, you need to know which python version you have.
Most provably you have python 2 or python 3 or even both version.
To check whether Python version you have, run the bellow commend
python -V
Output will as bellow -
Python 3.9.6
Step 2 : Check pip version
Check the pip version you have installed as bellow commend -
pip -V
Output will as bellow -
pip 21.1.3 (python 3.9)
Step 3 : Install BS4
With pip you can install BS4 by commend line commend as bellow -
pip install beautifulsoup4
OR
python -m pip install beautifulsoup4
Step 4 : Verify BS4 Installation
Verify BS4 is properly installed by show commend as bellow -
pip show beautifulsoup4
then you will show the output and confirm you have BS4, which version you have.
Step 5 : Import BS4 Package
After installing BS4 package, you can import the package as bellow -
from bs4 as BeautifulSoup
By following this guide you should have successfully installed BS4 on your system. If this article was helpful leave a comment.