python - Python:numpy:检测到解释器更改 - 每个进程只能将这个模块加载到一个解释器中
问题描述
我有一个在 Ubuntu 18.04、Apache 服务器、反应前端、Flask (selenium) 后端上运行的烧瓶应用程序。
我的应用程序运行良好,但有时我在 muy 服务器上收到以下消息:
numpy: Interpreter change detected - this module can only be loaded into one interpreter per process.
完整的错误日志:
mod_wsgi (pid=27625): Exception occurred processing WSGI script '/var/www/FlaskApp/flaskapp.wsgi'.
[Tue Sep 15 05:01:05.669296 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] Traceback (most recent call last):
[Tue Sep 15 05:01:05.669407 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] File "/var/www/FlaskApp/flaskapp.wsgi", line 7, in <module>
[Tue Sep 15 05:01:05.669451 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] from FlaskApp import app as application
[Tue Sep 15 05:01:05.669497 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] File "/var/www/FlaskApp/FlaskApp/__init__.py", line 5, in <module>
[Tue Sep 15 05:01:05.669538 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] import pandas as pd
[Tue Sep 15 05:01:05.669585 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] File "/usr/local/lib/python3.6/dist-packages/pandas/__init__.py", line 17, in <module>
[Tue Sep 15 05:01:05.669624 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] "Unable to import required dependencies:\\n" + "\\n".join(missing_dependencies)
[Tue Sep 15 05:01:05.669677 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] ImportError: Unable to import required dependencies:
[Tue Sep 15 05:01:05.669718 2020] [wsgi:error] [pid 27625:tid 140687123134208] [client 209.17.96.82:41300] numpy: Interpreter change detected - this module can only be loaded into one interpreter per process.
我不知道发生了什么或我应该改变什么。我读了一些关于更新 ini 文件以使用单个解释器的内容。
single-interpreter = true
但是我不确定这是否适用于我的应用程序,因为我使用的是 wsgi 并且这是针对 uswgi 的?
解决方案
尝试在 .conf 文件中添加WSGIApplicationGroup %{GLOBAL} 。(在我的情况下“纳米/etc/apache2/sites-available/FlaskApp.conf”)
推荐阅读
- javascript - HTML onUnclick 处理程序?
- vagrant - MacOs Big Sur 升级时遇到 Vagrant Up 错误
- javascript - 如果用户单击 d3.js 中的圆形,如何防止拖动?
- python - 与红眼检测混淆
- tfs - TFS 可以验证文件内容并拒绝/发出警告吗?
- java - 按下 Enter 键时调用一系列动作
- asp.net-core - BlazorWebAssembly 5.0 不从 Razor 类库加载静态资产
- wso2 - 如何在 WSO2 Stream Integrator 7.1.0 中配置数据源以自动重新连接 mysql
- c# - C# 使用带有外部服务的 itext 签署 pdf
- python - The Foundry NUKE 中的色差