flask + uwsgi + nginx + centos错误导入模块numpy [英] flask+uwsgi+nginx+centos error import module numpy

查看:238
本文介绍了flask + uwsgi + nginx + centos错误导入模块numpy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

带有numpy的virtualenv中的python 3.6

python 3.6 in virtualenv with numpy

当我启动服务时:

r-python uwsgi[9729]: def empty_like(prototype, dtype=None, order=None, subok=None):
r-python uwsgi[9729]: File "/home/user01/python/conserva/conservaenv/lib64/python3.6/site-packages/numpy/core/overrides.py", line 240, in decorator
r-python uwsgi[9729]: docs_from_dispatcher=docs_from_dispatcher)(implementation)
r-python uwsgi[9729]: File "/home/user01/python/conserva/conservaenv/lib64/python3.6/site-packages/numpy/core/overrides.py", line 204, in decorator
r-python uwsgi[9729]: add_docstring(implementation, dispatcher.__doc__)
r-python uwsgi[9729]: RuntimeError: empty_like method already has a docstring
r-python uwsgi[9729]: VACUUM: unix socket conserva.sock removed.
r-python systemd[1]: conserva.service: main process exited, code=exited, status=22/n/a
r-python systemd[1]: Unit conserva.service entered failed state.
r-python systemd[1]: conserva.service failed.

如果我从应用程序代码中删除了"import numpy",则该服务将运行.到底有什么问题?我该如何解决?

if i remove the 'import numpy' from the app code, the service run. Which is the problem? how can i fix it?

推荐答案

我在uWSGI下运行导入numpy的项目时遇到了这个问题. uWSGI使用的默认子解释器和numpy的初始化之间存在一些交互.

I've run into this while running projects under uWSGI that import numpy. There is some interaction between the default sub interpreters that uWSGIs uses and numpy's initialization.

您可以通过以下命令告诉uWSGI不要在您的配置中使用uWSGI的子解释器:

You can tell uWSGI to not use sub interpreters in your config for uWSGI with the line:

single-interpreter = true

在何处添加此内容取决于您如何配置uWSGI.

Where to add this will depend on how you configured uWSGI.

这篇关于flask + uwsgi + nginx + centos错误导入模块numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆