我想向谷歌电子表格报告一些事情,我的代码例如:
import json
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('con.json', scope)
gc = gspread.authorize(credentials)
wks = gc.open("temperatura")
ws = wks.get_worksheet(0)
ws.update_acell('A1','IT WORKS!')
我得到错误:
gc = gspread.authorize(credentials) AttributeError: 'module' object has no attribute 'authorize'
谢谢你的反馈
问候 马林
你的代码看起来没问题。为什么不重新安装gspread模块呢。在
您可以在一个文件夹中创建一个虚拟环境,并在其中安装所有必需的软件包。在
这可以帮助您在虚拟环境中运行所有项目,而不会影响其他模块或包。在
$pip安装virtualenv
$cd my_project_文件夹 $virtualenv my_项目
$cd我的项目 $source bin/激活
现在您可以安装所有模块和软件包了。在
http://docs.python-guide.org/en/latest/dev/virtualenvs/
相关问题 更多 >
编程相关推荐