Install BeautifulSoup Using PIP

To install BeautifulSoup, follow these steps:

  1. Open Command Line as administrator
  1. Enter the command:
pip install beautifulsoup4

Now, the BeautifulSoup library is installed and you can check what is the current version.

But first, you need to open the Python interpreter. Enter “python” in the command line and press Enter:

Next, insert these lines:

import bs4

In my case, the version is 4.9.3

Test BeautifulSoup

Now,  you can easily test this library and check whether it works. This code scrapes a site and returns the title of this site.

from bs4 import BeautifulSoup
import requests

url = ''
page = requests.get(url)
soup = BeautifulSoup(page.text, 'html.parser')
title = soup.find('title')

And this is the result:

Example Domain