简体   繁体   English

flask+uwsgi+nginx+centos 错误导入模块numpy

[英]flask+uwsgi+nginx+centos error import module numpy

python 3.6 in virtualenv with numpy带有 numpy 的 virtualenv 中的 python 3.6

when i start the service:当我启动服务时:

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.

if i remove the 'import numpy' from the app code, the service run.如果我从应用程序代码中删除“import numpy”,服务就会运行。 Which is the problem?哪个是问题? how can i fix it?我该如何解决?

I've run into this while running projects under uWSGI that import numpy.我在 uWSGI 下运行导入 numpy 的项目时遇到了这个问题。 There is some interaction between the default sub interpreters that uWSGIs uses and numpy's initialization. uWSGIs 使用的默认子解释器和 numpy 的初始化之间有一些交互。

You can tell uWSGI to not use sub interpreters in your config for uWSGI with the line:您可以使用以下行告诉 uWSGI 不要在 uWSGI 的配置中使用子解释器:

single-interpreter = true

Where to add this will depend on how you configured uWSGI.添加的位置取决于您如何配置 uWSGI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM