简体   繁体   English

App Engine错误没有模块google.cloud.speech和appengine.api

[英]App Engine Error No module google.cloud.speech and appengine.api

I'm using Google Cloud AppEngine based on the examples provided on Github I was testing the blobstore example but when I try to include the API google.cloud.speech in that example I get the error "No module named google.cloud.speech" but in the speech demo the same import it works. 我正在使用基于Github上提供的示例的Google Cloud AppEngine,正在测试blobstore示例,但是当我尝试在该示例中包含API google.cloud.speech时,出现错误“没有名为google.cloud.speech的模块”但在语音演示中,同样的导入效果也可以。

dev_appserver.py app.yaml dev_appserver.py app.yaml

In the speech demo when I include the import google.appengine.api I have the error No module named appengine.api, but the same import it works on the blobstore example. 在语音演示中,当我包含导入google.appengine.api时,出现错误No模块名为appengine.api,但相同的导入在blobstore示例中起作用。

python2.7 transcribeSpeech.py resources/audio.raw python2.7 transcribeSpeech.py​​资源/audio.raw

First Error 第一个错误

ERROR    2018-01-17 12:07:09,600 wsgi.py:263]
Traceback (most recent call last):
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/user/src/project/python_gae_quickstart_editor-2018-01-14-21-40/appengine/standard/blobstore/gcs/main.py", line 13, in <module>
    from google.cloud import speech
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/sandbox.py", line 1147, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named google.cloud.speech

Second error: 第二个错误:

Traceback (most recent call last):
  File "transcribeSpeech.py", line 39, in <module>
    import cloudstorage
  File "/home/user/src/project/python_gae_quickstart_editor-2018-01-14-21-40/appengine/standard/blobstore/gcs/lib/cloudstorage/__init__.py", line 20, in <module>
    from .api_utils import RetryParams
  File "/home/user/src/project/python_gae_quickstart_editor-2018-01-14-21-40/appengine/standard/blobstore/gcs/lib/cloudstorage/api_utils.py", line 45, in <module>
    from google.appengine.api import app_identity
ImportError: No module named appengine.apiv

You're mixing up standard env GAE apps (your 1st invocation) with standalone python apps (your 2nd invocation) - not the same thing, they don't work the same way, so don't make behaviour comparisons between them expecting to be the same/similar. 您正在将标准的env GAE应用程序(您的第一个调用)与独立的python应用程序(您的第二个调用)混合在一起-不一样,它们的工作方式不同,因此不要在期望的情况下进行行为比较相同/相似。 See GAE works but import webapp2 failed in Spyder . 请参阅GAE的作品,但在Spyder中导入webapp2失败

If your app is a GAE standard app (the only ones supported by dev_appserver.py ) then you have to vendor in all additional libraries inside your app (GAE doesn't know/care about libraries installed in your virtual env or your local python installation). 如果您的应用程序是GAE标准应用程序( dev_appserver.py支持的唯一应用程序),则您必须供应应用程序内的所有其他库(GAE不知道/不在乎虚拟环境或本地python安装中安装的库) )。 See python google app engine stripe integration . 请参阅python Google应用程序引擎条带集成

Each of the (standard env GAE) examples you're following contains a requirements.txt with the required libraries - that's the library you need to vendor in, don't just dump the entire example directory in your app and expect the examples to work (as the filepaths in your tracebacks appear to suggest). 您要遵循的每个(标准env GAE)示例都包含带有所需库的requirements.txt这是您需要提供的库,不要只是将整个示例目录转储到您的应用中并希望这些示例能够正常工作(如回溯中的文件路径所示)。 They're just independent snippets/examples, not a fully functional, ready-to-use app as a whole. 它们只是独立的摘录/示例,而不是一个功能全面,随时可用的应用程序。 See instructions at https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard 请参阅https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard中的说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google App Engine(Python 2.7)Win 10 ImportError:没有名为appengine.api的模块 - Google App Engine (Python 2.7) Win 10 ImportError: No module named appengine.api 从 google.cloud.speech 导入 SpeechClient 时出现属性错误 - Attribute Error when importing SpeechClient from google.cloud.speech 来自 google.cloud.speech 导入枚举的错误 google.cloud.speech 导入错误:无法导入名称“枚举” - ERROR google.cloud.speech from google.cloud.speech import enums ImportError: cannot import name 'enums' ImportError:没有名为appengine.api的模块 - ImportError: No module named appengine.api 在 Google App Engine 上部署 Django 应用程序后出现“没有名为 appengine.base 的模块”错误 - “No module named appengine.base” error after deploying Django app on Google App Engine 如何在 Google App Engine (python) 中导入 Google Cloud 语音识别 - How to import google cloud speech recognition in Google App Engine (python) 没有名为 appengine.ext google app engine 的模块 - No module named appengine.ext google app engine Google App Engine:ImportError:没有名为appengine.ext的模块 - Google App Engine: ImportError: No module named appengine.ext 语音请求错误中的Google的Cloud Speech API异常 - Google's Cloud speech API Exception in speech request error 在python应用程序中导入Google Cloud Bigquery api模块时出错 - Error importing Google Cloud Bigquery api module in python app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM