实现Hello Analytics API时出现Python错误

时间:2014-06-18 02:21:17

标签: python google-analytics

基本上,我遵循以下教程:

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

老实说,即使按照教程一步一步完成,我也不知道自己在做什么。

当我实现所有这些代码时,一切都很顺利,直到我将以下行添加到脚本hello_analytics_api_v3.py

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

我收到以下错误,我不知道这意味着什么。

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().

有人可以告诉我出了什么问题吗?

1 个答案:

答案 0 :(得分:0)

安装gflags库:

pip install --upgrade python-gflags

easy_install --upgrade python-gflags