JosephQuail
JosephQuail

Reputation: 23

BeautifulSoup Installed but for Python3 but I'm Unable to Find the bs4 Module

I'm using a Jupyter notebook for this on the Google Cloud Platform.

This code previously worked fine so I'm not sure what to do.

I've tried uninstalling and reinstalling, restarting the kernals, doing a pip3 install.

Any ideas would be much appreciated. I've attached an image here.

Juptyer Notebook

Upvotes: 0

Views: 236

Answers (2)

Federico Baù
Federico Baù

Reputation: 7685

Try this:

import bs4     

req= requests.get("https://url")
page = req.content
soup = bs4.BeautifulSoup(page) 

h1 = ...

And not

from bs4 import BeautifulSoup

Upvotes: 1

Sergio García
Sergio García

Reputation: 533

use this:

!pip install beautifulsoup4


from bs4 import BeautifulSoup as bs

Before doing it do Runtime->Reset all runtimes

Upvotes: 1

Related Questions