python - 数据存储属性错误: 'module' object has no attribute 'set_defaults'

标签 python google-compute-engine gcloud

从这里: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。

最佳答案

我启动了一个计算实例来尝试这个包,但实际上遇到了同样的问题。不过这是预期的。

在撰写本文时,gcloud(PyPI 软件包)的最新版本是 0.3.0。如果你看一下diff between the release tag and master并检查更改的文件。很明显,自上一个包以来,master 有很多 API 更改,包括您尝试调用的函数。

您可能需要结账gcloud-python从源代码并以这种方式安装它以使用更新的 API 功能。

关于python - 数据存储属性错误: 'module' object has no attribute 'set_defaults' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28080232/

相关文章:

python - 数据框中非数字和零值单元格的索引

python - pytest 是否支持测试名称中的 unicode?

postgresql - 在 Amazon EC2/Google Compute Engine 中设置 XNAT

google-compute-engine - 实例和实例组有什么区别

github - 在 google 计算引擎上动态部署 Jenkins slaves 以进行 github 提交

google-cloud-platform - GCP 通过 Compute Engine 的服务帐号访问和存储密码/凭据的正确方法

google-cloud-platform - gcloud 崩溃(属性错误): 'NoneType' object has no attribute 'revisionTemplate'

python - Pandas 滚动申请不做任何事情

python - 我的learning_rate真的在theano中改变了吗?

amazon-s3 - Rails ActiveStorage 的谷歌云存储 CORS 问题