无法在google-app-engine开发服务器

时间:2016-06-19 14:39:12

标签: python google-app-engine numpy

从Ubuntu 14.04升级到16.04后,我在本地开发服务器上出现以下错误:

ERROR    2016-06-19 14:03:10,294 wsgi.py:263] 
Traceback (most recent call last):
File "/home/mort/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/mort/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/mort/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/mort/python/ms-image-analysis/src/index.py", line 5, in <module>
import imagemodels
File "/home/mort/python/ms-image-analysis/src/imagemodels.py", line 5, in <module>
import numpy.random as random
File     "/home/mort/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 705, in load_module
module = self._find_and_load_module(fullname, fullname, [module_path])
File "/home/mort/google_appengine/google/appengine/tools/devappserver2/python/s andbox.py", line 446, in _find_and_load_module
return imp.load_module(fullname, source_file, path_name, description)
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 180,  in <module>
from . import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 22, in <module>
from . import _internal  # for freeze programs
File "/usr/lib/python2.7/dist-packages/numpy/core/_internal.py", line 14, in <module>
import ctypes
File "/usr/lib/python2.7/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
File "/home/mort/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 963, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named _ctypes

这似乎是由numpy导入引发的。我当地的numpy版本是1:1.11.0。我应该使用运行时支持的版本1.6.1吗?

谢谢,

莫特

1 个答案:

答案 0 :(得分:4)

在执行以下操作时,您需要在本地系统上安装相应版本的1.6.1以匹配运行时支持的版本1.6.1:

libraries:
- name: numpy
  version: "1.6.1"

虽然使用app engine flexible,但您可以运行任何您想要的numpy版本;)