好的,我正在跟随“成为一名技术营销人员”类(class),并且正在尝试学习如何使用GSpread管理Google Spreadsheets。我遵循了http://gspread.readthedocs.io/en/latest/oauth2.html的文档。我按照上面第二个URL中的步骤进行操作,并使用以下代码运行了一个文档:

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds']

credentials = ServiceAccountCredentials.from_json_keyfile_name('DFS Google Sheets Data Imports-7205de852ff7.json', scope)

gc = gspread.authorize(credentials)

wks = gc.open("Authority Scraper").sheet1
wks.update_cell(1,2,"Hello World!")

由此,我在终端中收到错误:从oauth2client.service_account导入ServiceAccountCredentials
ImportError:没有名为oauth2client.service_account的模块

terminal error printout

有人请帮助我。其他名为oath2client.service_account的No模块的答案对我不起作用。谢谢!

最佳答案

运行此命令对我有用-
sudo pip install --upgrade oauth2client
从oauth2client库github repo得到了这个

关于python - GSpread ImportError : No module named oauth2client. service_account,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37850004/

10-08 23:21