ModuleNotFoundError:没有名为“ encodings”的模块; rhel8; python3; apache2.4; mod_wsgi; django 3.1

问题描述

正在尝试使用apache和mod_wsgi设置django应用程序(虚拟环境)。该应用程序正在RHEL8计算机上运行,​​并且唯一运行的python是python 3。

RHEL版本== Red Hat Enterprise Linux 8.2版(Ootpa)

python版本== Python 3.6.8。

apache版本== Apache / 2.4.37(Red Hat Enterprise Linux)。

mod_wsgi版本== 4.7.1。

django版本== 3.1。

我的Python虚拟环境主页为: python-home using sys.prefix

我已经使用CMMI方法创建了mod_wsgi.so。下面是图书馆的详细信息

ldd mod_wsgi.so details

以下是我用于apache的虚拟主机conf文件。 我也曾尝试添加python-path(如下所示),尽管未在下面的conf文件中编写细节。

WsgiDaemonProcess sohail python-home=/home/ilearn/webapps/sohail python-path=/home/ilearn/webapps/sohail/src
@H_404_22@

webapptest.conf:

<VirtualHost *:80>

WsgiScriptAlias /webapptest /home/ilearn/webapps/sohail/src/webapptraining/wsgi.py
WsgiDaemonProcess sohail python-home=/home/ilearn/webapps/sohail

WsgiProcessGroup sohail
WsgiApplicationGroup %{GLOBAL}


<Directory /home/ilearn/webapps/sohail/src/webapptraining>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

</VirtualHost>
@H_404_22@

启动apache服务器后,我会在错误日志中看到错误ModuleNotFoundError: No module named 'encodings'@H_404_22@。

[core:notice] [pid 4576:tid 139861315184960] AH00052: child pid 4893 exit signal Aborted (6)
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
@H_404_22@

感谢任何帮助或建议来解决问题。

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)