Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Install BeautifulSoup in Python on MacOS?

  • Last Updated : 14 Sep, 2021

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

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.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!