python - 使用 Scikit-learn 谷歌应用引擎

标签 python python-2.7 google-app-engine scikit-learn

我正在尝试在谷歌应用引擎上部署 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 installmake在源目录中。如果您使用过安装程序,请检查它是否适合您的 Python 版本、操作系统和平台。

他们有在谷歌应用引擎上使用 scikit-learn 的方法吗?

最佳答案

Scikit-learn 现在可以在 App Engine 柔性环境中使用。

sklearn 只需要在 requirements.txt 文件中指定为依赖项。

查看此 repo有关如何在 App Engine 上提供 sklearn 模型的代码示例。

关于python - 使用 Scikit-learn 谷歌应用引擎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35987785/

相关文章:

python - 如何在Python中使用argparse获取命令行参数?

python - 有没有办法在另一个图上绘制普通最小二乘类型的线?

python - 导入错误 : Pillow 3. 3.1 和 Python 2.7 和 El Capitan 操作系统

Python App Engine 后端为 cron 工作,但如果我直接点击 url 则不会

python - Scrapy 没有听拒绝规则

python - Python 2.7 不支持 Readline

python - 将列表列表的列表展平为列表列表

python - 无法针对谷歌云sql运行manage.py

python - 如何从 Python GAE 中检索到的谷歌云存储对象访问我的文件

python - 如何通过python google drive api创建一个新文件夹以及MediaFileUpload的用途是什么?