GAE Python PyML ImportError:没有名为_ckernel的模块

时间:2015-06-17 08:55:44

标签: python google-app-engine pyml

我尝试在Google App Engine上导入PyML作为另一个库的要求,但是我收到以下导入错误:

  File "/base/data/home/apps/s~myapp/uno.385079313378714244/PyML/__init__.py", line 4, in <module>
from PyML.containers import *
  File "/base/data/home/apps/s~myapp/uno.385079313378714244/PyML/containers/__init__.py", line 3, in <module>
VectorDataSet = __import__('PyML.containers.vectorDatasets', fromlist=['']).VectorDataSet
  File "/base/data/home/apps/s~myapp/uno.385079313378714244/PyML/containers/vectorDatasets.py", line 5, in <module>
from PyML.containers.baseDatasets import WrapperDataSet, BaseVectorDataSet
  File "/base/data/home/apps/s~replimeapp/uno.385079313378714244/PyML/containers/baseDatasets.py", line 4, in <module>
from PyML.containers import ker
  File "/base/data/home/apps/s~myapp/uno.385079313378714244/PyML/containers/ker.py", line 6, in <module>
from ext import ckernel
  File "/base/data/home/apps/s~myapp/uno.385079313378714244/PyML/containers/ext/ckernel.py", line 25, in <module>
_ckernel = swig_import_helper()
  File "/base/data/home/apps/s~myapp/uno.385079313378714244/PyML/containers/ext/ckernel.py", line 17, in swig_import_helper
import _ckernel
ImportError: No module named _ckernel

我在网上搜索过这个错误,可以找到其他有问题的人,但没有给出答案。

UPDATE 导致错误的代码:

from sys import version_info
if version_info >= (2,6,0):
  def swig_import_helper():
    from os.path import dirname
    import imp
    fp = None
    try:
        fp, pathname, description = imp.find_module('_ckernel', [dirname(__file__)])
    except ImportError:
        import _ckernel
        return _ckernel
    if fp is not None:
        try:
            _mod = imp.load_module('_ckernel', fp, pathname, description)
        finally:
            fp.close()
        return _mod
  _ckernel = swig_import_helper()
  del swig_import_helper
else:
  import _ckernel
del version_info

1 个答案:

答案 0 :(得分:1)

该代码似乎正在使用swig。 Appengine运行时沙箱将基于“c”的二进制库限制为受支持的集合。 Swig通常意味着用Python包装的编译C / C ++。所以看起来这不能在appengine上运行,除非他们有一个纯python选项。

您可以在托管VM下运行它。

您应该回过头来阅读有关Python沙盒的信息,以及它的局限性和直接支持第三方库的内容。