从这里开始:http://googlecloudplatform.github.io/gcloud-python/datastore-api.html
from gcloud import datastore
datastore.set_defaults()
网络出现此错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'set_defaults'
This happens in Windows 7 and GCE standard setup.
$ gcloud version
Google Cloud SDK 0.9.31
bq 2.0.18
bq-win 2.0.17
compute 2014.09.09
core 2014.09.02
core-win 2014.06.03
dns 2014.09.02
gae-java 1.9.10
gae-java-win 1.9.3
gcutil 1.16.5
gcutil-win 1.16.0
gsutil 4.5
gsutil-win 3.42
sql 2014.09.02
windows-ssh-tools 2014.07.15
好像正在调用错误版本的gcloud.datastore。
答案 0 :(得分:1)
我启动了一个计算实例来尝试这个包,实际上遇到了同样的问题。它的预期虽然。
撰写本文时,最新版本的gcloud(PyPI包)为0.3.0。如果您查看diff between the release tag and master并检查更改的文件。很明显,自上一个软件包以来,master有很多API更改,包括您尝试调用的函数。
您可能需要从源代码检出gcloud-python并以此方式安装以使用较新的API功能。