[英]How to access Google cloud library in python3 standard app engine project?
I'm trying to use the datastore in the google cloud sdk.我正在尝试使用谷歌云 sdk 中的数据存储。
When I try and import:当我尝试导入时:
from google.cloud import datastore
I get the error:我收到错误:
ModuleNotFoundError: No module named 'google.cloud'
ModuleNotFoundError:没有名为“google.cloud”的模块
But I do have the google cloud sdk installed and it's available in my lib directory:但是我确实安装了 google cloud sdk 并且它在我的 lib 目录中可用:
The problem seems to be that when I try and import it another google folder is used:问题似乎是当我尝试导入它时使用了另一个 google 文件夹:
Edit: After running pip3 install --upgrade google-cloud-datastore
I can now import google.cloud from the command line but it still does not work in my project.编辑:运行
pip3 install --upgrade google-cloud-datastore
我现在可以从命令行导入 google.cloud 但它在我的项目中仍然不起作用。
What next steps can I take to solve this issue?我可以采取哪些后续步骤来解决此问题?
I managed to reproduce the issue that you got.我设法重现了您遇到的问题。 If we follow the documentation here then indeed it doesn't work.
如果我们遵循此处的文档,那么它确实不起作用。 However, if you run
pip3 install --upgrade google-cloud-datastore
then it does the trick.但是,如果您运行
pip3 install --upgrade google-cloud-datastore
那么它就可以解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.