Okie dokie,
我正在尝试将Google的Dialogflow python API与Google App Engine配合使用,而且在运行应用程序时,我似乎遇到了问题。我已经安装了一个lib文件夹的对话框,并通过app.yaml文件添加了lib文件夹。我一直遇到一个错误,它说它找不到'six.moves'。这是一个非常新的(一般的应用程序引擎),所以请告诉我,如果我有一些设置错误。
我读过其他一些没有运气的帖子。这不会在本地或部署。
下面是我的app.yaml文件:runtime: python27
api_version: 1
threadsafe: true
service: basic-npl-ui
handlers:
- url: /img
static_dir: img
- url: /javascript
static_dir: javascript
- url: /css
static_dir: css
- url: /.*
script: main.app
env_variables:
GAE_USE_SOCKETS_HTTPLIB: 'anyvalue'
libraries:
- name: jinja2
version: latest
- name: webapp2
version: latest
- name: ssl
version: latest
- name: grpcio
version: latest
这是我的错误日志(本地开发):
Traceback (most recent call last):
File "/Users/AVD1WIP/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/AVD1WIP/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Users/AVD1WIP/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/AVD1WIP/Documents/Orca_interns/NLP/basic_ui_app/main.py", line 28, in <module>
from src.dialog_response_util import DialogflowResponseUtil
File "/Users/AVD1WIP/Documents/Orca_interns/NLP/basic_ui_app/src/dialog_response_util.py", line 2, in <module>
import dialogflow
File "/Users/AVD1WIP/Documents/Orca_interns/NLP/basic_ui_app/lib/dialogflow/__init__.py", line 17, in <module>
from dialogflow_v2 import AgentsClient
File "/Users/AVD1WIP/Documents/Orca_interns/NLP/basic_ui_app/lib/dialogflow_v2/__init__.py", line 18, in <module>
from dialogflow_v2.gapic import agents_client
File "/Users/AVD1WIP/Documents/Orca_interns/NLP/basic_ui_app/lib/dialogflow_v2/gapic/agents_client.py", line 19, in <module>
import google.api_core.gapic_v1.client_info
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/api_core/gapic_v1/__init__.py", line 16, in <module>
from google.api_core.gapic_v1 import config
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/api_core/gapic_v1/config.py", line 26, in <module>
from google.api_core import exceptions
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/api_core/exceptions.py", line 26, in <module>
from six.moves import http_client
ImportError: No module named moves
INFO 2018-06-08 20:20:19,020 module.py:846] basic-npl-ui: "GET / HTTP/1.1" 500 -
答案 0 :(得分:0)
回溯表示您的应用程序的lib
目录中没有安装某些依赖项,它们将从您的本地python安装库中获取。请注意其中的.../python2.7/site-packages/google/api_core/gapic_v1
路径。
您需要在应用的lib
目录中安装所有应用的依赖项,如here中所述。
答案 1 :(得分:0)
我也遇到了这个问题,请确保您“依赖”所有依赖项,例如
pip install -t lib six==1.9.0
要解决此错误,我必须指定版本以与gcloud工具在本地安装的python库中使用的版本相匹配
答案 2 :(得分:0)
这个问题使我疯狂了一段时间,网上没有任何帮助。我终于从grpcio
库中删除了app.yaml
,它起作用了:
libraries:
- name: grpcio
version: latest