Open In App

How to Install BeautifulSoup in Python on MacOS?

Improve
Improve
Like Article
Like
Save
Share
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.


Last Updated : 14 Sep, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads