Cloud Shell 中没有名为“google.appengine”的模块

Rog*_*ogB 2 google-app-engine google-cloud-platform google-app-engine-python

我正在测试 Google App Engine 并尝试运行一个简单的函数来将文件上传到 Blobstore 或 Cloud Storage。我直接在实例的 Cloud Shell 中键入 Python 代码。当我打电话时代码失败:

from google.appengine.ext import blobstore

我得到错误代码:

Traceback (most recent call last): File "upload_test.py", line 1, in <module> from google.appengine.api import users ImportError: No module named 'google.appengine'

尽管文档说:您可以使用已经安装了 git 和 Cloud SDK 的 Google Cloud Shell,但我尝试安装了一堆库:

gcloud components install app-engine-python

pip install google-cloud-datastore

pip install google-cloud-storage

pip install --upgrade google-api-python-client

我仍然遇到同样的错误。如何让 appengine 库工作?或者,这是创建允许用户上传文件的应用程序的错误方法吗?

Dus*_*ram 5

google.appengine模块已融入第一代 Python (2.7) 运行时。无法通过pip、在第二代 (3.7) 运行时或 Cloud Shell 中安装。

使用它的唯一方法是编写和部署第一代 App Engine 应用程序。