我正在尝试在谷歌应用引擎上部署 python2.7 应用程序。它使用了一些模块,如 numpy、flask、pandas 和 scikit-learn。虽然我能够安装和使用其他模块。在项目的 lib 文件夹中安装 scikit-learn 会出现以下错误:-
追溯(最近调用最后一次):文件“/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py”,第 240 行,在句柄处理程序中= _config_handle.add_wsgi_middleware(self._LoadHandler()) 文件“/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py”,第 299 行,在 _LoadHandler 处理程序中,路径, err = LoadObject(self._handler) 文件“/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py”,第 85 行,在 LoadObject obj = __import__(path[0 ]) 文件“/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/deploynew.py”,第6行,导入sklearn文件“/base/data/home/apps/s~category -prediction-1247/v1.391344087004233892/lib/sklearn/__init__.py”,第 56 行,来自 .导入 __check_build 文件“/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/lib/sklearn/__check_build/__init__.py”,第 46 行,在 raise_build_error(e) 文件“/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/lib/sklearn/__check_build/__init__.py", 第 41 行,在 raise_build_error %s"""% (e, local_dir, ''.join(dir_content ).strip(), msg)) ImportError: dynamic module does not define init function (init_check_build) ________________________________________________________________________________/base/data/home/apps/s~category-prediction-1247/v1.391344087004233892/lib/sklearn/__check_build 的内容: setup.pyc __init__.py _check_build.so setup.py __init__.pyc ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ : 运行 python setup.py install
或 make
在源目录中。如果您使用过安装程序,请检查它是否适合您的 Python 版本、操作系统和平台。
他们有在谷歌应用引擎上使用 scikit-learn 的方法吗?
最佳答案
Scikit-learn 现在可以在 App Engine 柔性环境中使用。
sklearn
只需要在 requirements.txt
文件中指定为依赖项。
查看此 repo有关如何在 App Engine 上提供 sklearn
模型的代码示例。
关于python - 使用 Scikit-learn 谷歌应用引擎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35987785/