After trying installed by using pip3 — yet, it still showing No module named ‘oauth2client’
Announced on Google Auth Library for Python that oauth2client has been deprecated, then installed google-auth is recommended.
Here is how to do so..
Create new environment
- cd <desired directory> #i.e. cd Desktop/GA_project
- pip3 install virtualenv
- virtualenv <desired_name> # this case GoogleAnalytics_test
i.e. virtualenv GoogleAnalytics_test - source GoogleAnalytics_test/bin/activate
- GoogleAnalytics_test/bin/pip install google-api-python-client
In your workspace install google-auth (mine — jupyter notebook)
From this…
Replace above (deprecated version) to the code below (credits to Lamroy95’s — Much appreciated!)
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
Done!