我正在尝试在谷歌应用引擎上使用客户端和 gcloud 存储桶。首先,我安装 gcloud。
pip install gcloud -t my_project_directory
其次,我开始导入 gcloud 并使用它。这是我的代码:
from gcloud import storage
class printstr(webapp2.RequestHandler):
def get(self):
self.response.out.write("YA")
config = {}
config['webapp2_extras.sessions'] = {
'secret_key': 'my-super-secret-key',
}
app = webapp2.WSGIApplication([('/back/printstr', printstr),
], debug=True, config=config)
当我打开地址(localhost:8080/back/printstr)时,我应该在页面上看到“YA”。但我得到 HTTP ERROR 500。我看到了日志:
from google.protobuf import timestamp_pb2
ImportError: No module named protobuf
我确定google(文件夹)有一个protobuf(文件夹),protobuf(文件夹)有一个timestamp_pb2.py。但是,我不知道为什么会出现此错误?关于我应该如何使用 gcloud 的任何帮助?
谢谢!