简体   繁体   English

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

[英]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.

相关问题 无法使用谷歌云日志记录在python3标准环境的谷歌应用引擎中打印相关日志的模块名称和行号 - Unable to print module name and line number for correlated logs in google app engine fo python3 standard environment using google cloud logging Google Cloud App Engine的最佳做法:Python2或Python3? - Best practices with google cloud app engine: Python2 or Python3? 如何在Python3中使用App Engine安排Cloud Datastore导出 - How to schedule a Cloud Datastore export with App Engine in Python3 即使删除了所有版本,Google App Engine标准Python3应用程序仍会提供旧文件 - Google App Engine Standard Python3 app still serving old files, even if all versions deleted 如何构建标准Python项目(模块,库)以供将来在Google App Engine中使用? - How to structure standard Python project (modules, libraries) for future use in Google App Engine? 如何在 Google App Engine for Python3 上安装库 - How to install libraries on Google App Engine for Python3 无法将twilio-python库添加到Google App Engine项目 - cant add the twilio-python library to a Google App Engine project 如何在Google Compute Engine中通过Python访问Google Cloud SQL - How to access Google Cloud SQL by Python in Google Compute Engine 如何在Google Cloud Platform中为Node应用程序安装Python3 - How to install Python3 in Google Cloud Platform for a Node app 无法在本地 flask python3 环境中使用 Google 应用引擎中的 Cloud NDB - Unable to use Cloud NDB in local flask python3 environment with google app engine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM