Open In App

How to Install BeautifulSoup in Python on MacOS?

Last Updated : 14 Sep, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

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

Step 2: Check if pip3 and python3 are correctly installed.

python3 --version
pip3 --version
How to Install BeautifulSoup in Python on MacOS

Step 3: Upgrade your pip to avoid errors during installation.

pip3 install --upgrade pip
How to Install BeautifulSoup in Python on MacOS?

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

pip3 install beautifulsoup4
How to Install BeautifulSoup in Python on MacOS?

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

How to Install BeautifulSoup in Python on MacOS

Step 2: Extract the downloaded package using the following command.

tar -xzvf bs.tar.gz 
How to Install BeautifulSoup in Python on MacOS

Step 3: Go inside the folder and Enter the following command to install the package.

cd beautifulsoup4-4.10.0
python3 setup.py install
How to Install BeautifulSoup in Python on MacOS

Verifying Installation

Import the module in the Python terminal to check if Beautiful Soup is installed correctly

from bs4 import BeautifulSoup 
How to Install BeautifulSoup in Python on MacOS?

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


Next Article

Similar Reads