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

时间:2020-09-23 18:16:34

标签: python-3.x django apache mod-wsgi rhel8

正在尝试使用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

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>

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

[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'

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

谢谢。

0 个答案:

没有答案