如何在python3标准应用引擎项目中访问Google云库?

2024-04-25 06:13:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用googlecloudsdk中的数据存储。你知道吗

当我尝试导入时:

from google.cloud import datastore

我得到一个错误:

ModuleNotFoundError: No module named 'google.cloud'

但我确实安装了google cloud sdk,并且可以在我的lib目录中找到它:

enter image description here

问题似乎是,当我尝试导入它时,使用了另一个google文件夹:

enter image description here

编辑: 运行pip3 install --upgrade google-cloud-datastore之后,我现在可以导入了谷歌云但在我的项目中仍然不起作用。你知道吗

下一步我可以采取什么措施来解决这个问题?你知道吗


Tags: 数据nofromimport目录cloudlib错误
1条回答
网友
1楼 · 发布于 2024-04-25 06:13:23

我设法重现了你的问题。如果我们遵循文档here,那么它确实不起作用。但是,如果您运行pip3 install upgrade google-cloud-datastore,那么它就会起作用。你知道吗

相关问题 更多 >