ModuleNotFoundError: No module named 'google'

Prog AF picture Prog AF · Aug 27, 2018 · Viewed 13k times · Source

Once I am trying to use google search api it's showing me an error:

Traceback (most recent call last):
  File "C:\Users\Maor Ben Lulu\Desktop\Maor\Python\google\google_Bot.py", line 1, in <module>
    from google import google
ModuleNotFoundError: No module named 'google'

My code :

from google import google
import urllib.request
import time
from bs4 import BeautifulSoup

def google_scrape(url):
    thepage = urllib.request.urlopen(url)
    soup = BeautifulSoup(thepage, "html.parser")
#    print(soup.prettify())
    return soup.prettify()
### Rest of the code

I did:

pip install google

But still doesn't work.

Answer

Sachin Rajput picture Sachin Rajput · Nov 2, 2020

This will solve you issue But you have to do import google not from google import google

pip install --upgrade google-api-python-client