我在尝试Google Drive SDK快速入门示例(https://developers.google.com/drive/quickstart)时收到以下错误消息。
Traceback (most recent call last):
File "quickstart.py", line 6, in <module>
from apiclient.discovery import build
File "build/bdist.macosx-10.6-intel/egg/apiclient/discovery.py", line 45, in <module>
File "build/bdist.macosx-10.6-intel/egg/apiclient/errors.py", line 26, in <module>
ImportError: cannot import name util正如教程中所解释的,首先在我的Mac终端上:
easy_install --upgrade google-api-python-client我使用的是Mac OS 10.7.4 python 2.7.2
发布于 2017-03-09 13:33:34
我推荐使用pip而不是easy_install。根据this answer对一个类似问题的回答,客户端库和oauth2client库很可能是不兼容的。最好同时使用pip install -U google-api-python-client (或者Python3的pip3 )进行升级。
快速入门后,如果你想看更长一点的、更真实的使用Drive API的例子,下面是我为你制作的一些视频和博客文章:
(*) - TL;DR:上传纯文本文件到驱动器,导入/转换为Google Docs格式,然后将该文档导出为PDF。上面的帖子使用了Drive API v2;this follow-up post描述了如何将其迁移到Drive API v3,这里的developer video结合了这两篇“穷人的转换器”。
https://stackoverflow.com/questions/12574307
复制相似问题