【发布时间】:2026-02-21 02:25:01
【问题描述】:
我有一个在 Ubuntu 18.04、Apache 服务器、React 前端、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 的?
【问题讨论】:
-
哇 - 有人实际上在使用子解释器。
-
我不知道解释器是什么。我如何确保我只使用一个?所以这个问题不会发生?
-
我想将 WSGIApplicationGroup %{GLOBAL} 添加到我的 000-default.conf 可以使这项工作?
标签: python apache numpy flask wsgi