简体   繁体   中英

Python Error when implementing Hello Analytics API

Basically, I am following the following tutorial:

https://developers.google.com/analytics/solutions/articles/hello-analytics-api#introduction

To be honest, I have no idea what I was doing, even after following the tutorial step by step.

When I implemented all of these codes, everything was going fine until I added the following line to the script hello_analytics_api_v3.py .

if __name__ == '__main__':
  main(sys.argv)

I got the following error, which I have no idea what it means.

Traceback (most recent call last):
  File "/Users/Python Projects/hello_analytics_api_v3.py", line 83, in <module>
    main(sys.argv)
  File "/Users/Python Projects/hello_analytics_api_v3.py", line 15, in main
    service = hello_analytics_api_v3_auth.initialize_service()
  File "/Users/Python Projects/hello_analytics_api_v3_auth.py", line 39, in initialize_service
    credentials = prepare_credentials()
  File "/Users/Python Projects/hello_analytics_api_v3_auth.py", line 32, in prepare_credentials
    credentials = run(FLOW, storage)
  File "build/bdist.macosx-10.9-intel/egg/oauth2client/tools.py", line 241, in run
NotImplementedError: The gflags library must be installed to use tools.run(). Please install gflags or preferrably switch to using tools.run_flow().

Can someone tell me what went wrong ?

Install the gflags library:

pip install --upgrade python-gflags

or

easy_install --upgrade python-gflags

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM