Apache,mod_wsgi和Pandas导入错误,由于错误而无法导入依赖项Numpy

我可以在没有Pandas库的情况下部署flask应用程序,因此我认为服务器的设置没有任何问题。另外,我可以在flask的开发服务器上用熊猫运行我的flask应用程序,因此我认为这可能与mod_wsgi有关。 我正在使用配置的Apache / 2.4.37(红帽企业版Linux)mod_wsgi / 4.6.4 Python / 3.6。

我无法导入熊猫,尝试通过mod_wsgi导入会产生此错误。

[Mon Nov 18 08:03:25.792041 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]     "Unable to import required dependencies:\\n" + "\\n".join(missing_dependencies)
[Mon Nov 18 08:03:25.792058 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] ImportError: Unable to import required dependencies:
[Mon Nov 18 08:03:25.792063 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] numpy:
[Mon Nov 18 08:03:25.792066 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]
[Mon Nov 18 08:03:25.792068 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
[Mon Nov 18 08:03:25.792071 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]
[Mon Nov 18 08:03:25.792074 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] Importing the numpy c-extensions failed.
[Mon Nov 18 08:03:25.792101 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] - Try uninstalling and reinstalling numpy.
[Mon Nov 18 08:03:25.792105 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] - If you have already done that,then:
[Mon Nov 18 08:03:25.792108 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]   1. Check that you expected to use Python3.6 from "/usr/bin/python3",[Mon Nov 18 08:03:25.792111 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      and that you have no directories in your PATH or PYTHONPATH that can
[Mon Nov 18 08:03:25.792114 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      interfere with the Python and numpy version "1.17.4" you're trying to use.
[Mon Nov 18 08:03:25.792117 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]   2. If (1) looks fine,you can open a new issue at
[Mon Nov 18 08:03:25.792120 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      https://github.com/numpy/numpy/issues.  Please include details on:
[Mon Nov 18 08:03:25.792123 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      - how you installed Python
[Mon Nov 18 08:03:25.792126 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      - how you installed numpy
[Mon Nov 18 08:03:25.792129 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      - your operating system
[Mon Nov 18 08:03:25.792131 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      - whether or not you have multiple versions of Python installed
[Mon Nov 18 08:03:25.792134 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]      - if you built from source,your compiler versions and ideally a build log
[Mon Nov 18 08:03:25.792137 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]
[Mon Nov 18 08:03:25.792140 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] - If you're working with a numpy git repository,try `git clean -xdf`
[Mon Nov 18 08:03:25.792143 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]   (removes all files not under version control) and rebuild numpy.
[Mon Nov 18 08:03:25.792146 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]
[Mon Nov 18 08:03:25.792149 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] Note: this error has many possible causes,so please don't comment on
[Mon Nov 18 08:03:25.792152 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] an existing issue about this - open a new one instead.
[Mon Nov 18 08:03:25.792155 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252]
[Mon Nov 18 08:03:25.792157 2019] [wsgi:error] [pid 13940:tid 140279706347264] [remote 73.71.92.203:61252] Original error was: /var/www/app/KENV/lib/python3.6/site-packages/numpy/core/_multiarray_umath.cpython-36m-x86_64-linux-gnu.so: failed to map segment from shared object

我正在运行python 3.6.8,pandas是0.25.1,numpy是1.17.4。

powerbww 回答:Apache,mod_wsgi和Pandas导入错误,由于错误而无法导入依赖项Numpy

该错误可能是由于SELinux限制所致。

请注意,即使您设法说服系统加载共享库,但由于numpy并不真正support python sub-interpreters

,因此在mod_wsgi下使用numpy还是行不通的。
本文链接:https://www.f2er.com/3082719.html

大家都在问