How to Install BeautifulSoup in Python on MacOS?
In this article, we will learn how to install Beautiful Soup in Python on MacOS.
Installation
Method 1: Using pip to install BeautifulSoup
Step 1: Install latest Python3 in MacOS
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Step 2: Check if pip3 and python3 are correctly installed.
python3 --version pip3 --version

Step 3: Upgrade your pip to avoid errors during installation.
pip3 install --upgrade pip

Step 4: Enter the following command to install Beautiful Soup using pip.
pip3 install beautifulsoup4

Method 2: Using setup.py to install BeautifulSoup
Step 1: Download the latest package of Beautiful Soup for python3.
curl https://files.pythonhosted.org/packages/a1/69/daeee6d8f22c997e522cdbeb59641c4d31ab120aba0f2c799500f7456b7e/beautifulsoup4-4.10.0.tar.gz > bs.tar.gz

Step 2: Extract the downloaded package using the following command.
tar -xzvf bs.tar.gz

Step 3: Go inside the folder and Enter the following command to install the package.
cd beautifulsoup4-4.10.0 python3 setup.py install

Verifying Installation
Import the module in the Python terminal to check if Beautiful Soup is installed correctly
from bs4 import BeautifulSoup

Note: If there is any error while importing the module then is not installed properly.


