我正在尝试学习谷歌API,我的经验是用Python,所以我试图使用谷歌api python客户端访问一些谷歌的服务,但我遇到一个错误构建服务对象.
从apiclient.discovery导入构建模块没有问题:
>>> from apiclient.discovery import build
>>>
Run Code Online (Sandbox Code Playgroud)
但是到了构建服务对象的时候(就像我下载的教程文件中所做的那样),崩溃了,我无法弄清楚出了什么问题!
>>> service = build('books','v1',developerKey=api_key)
WARNING:root:No module named locked_file
Traceback (most recent call last):
File "build/bdist.macosx-10.10-intel/egg/googleapiclient/discovery_cache/__init__.py", line 38, in autodetect
from . import file_cache
File "build/bdist.macosx-10.10-intel/egg/googleapiclient/discovery_cache/file_cache.py", line 32, in <module>
ImportError: No module named locked_file
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.10-intel/egg/oauth2client/util.py", line 140, in positional_wrapper
File "build/bdist.macosx-10.10-intel/egg/googleapiclient/discovery.py", line 196, in build
File "build/bdist.macosx-10.10-intel/egg/googleapiclient/discovery.py", line 242, in _retrieve_discovery_doc
File "/Library/Python/2.7/site-packages/httplib2-0.9.2-py2.7.egg/httplib2/__init__.py", line 1609, in request
(response, …Run Code Online (Sandbox Code Playgroud)