尝试使用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
答案 0 :(得分:2)
我建议使用pip
代替easy_install
。根据{{3}}类似的问题,客户端库和oauth2client
库可能不兼容。最好使用pip install -U google-api-python-client
(或Python 3的pip3
)进行升级。
快速入门后,如果你想看到更长的,更真实的世界&#34;使用Drive API的示例,以下是我为您制作的一些视频和博客文章:
(*) - TL; DR:将纯文本文件上传到云端硬盘,导入/转换为Google文档格式,然后将该文档导出为PDF格式。上面的帖子使用Drive API v2; post描述了将其迁移到Drive API v3,并且this follow-up post结合了穷人的转换器&#34;讯息。