how to set WSGI of appache2 to work with python 3.7? how to set WSGI of appache2 to work with python 3.7? python-3.x python-3.x

how to set WSGI of appache2 to work with python 3.7?


you need to built python and then built wsgi since the default wsgi is built based on the is system python use this tutorialhttps://medium.com/@garethbjohnson/serve-python-3-7-with-mod-wsgi-on-ubuntu-16-d9c7ab79e03a


make custom builds of Python and mod_wsgi ourselves.

apt install apache2 apache2-devwget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.7.1.tar.gztar xvfz 4.7.1.tar.gzcd mod_wsgi-4.7.1./configure --with-python=[your python path]## For example: ./configure --with-python=/usr/bin/python3.7sudo makesudo make install## Finally:sudo systemctl reload apache2

You can use which python3.7 to find the path of the Python file.


I had a similar error message, it turned out that SELinux enforcement is the culprit.You can try to turn off SELinux temporary to test.

setenforce 0// run sestatus to confirm that either it's permissive or disabledsestatus

If that fixes your issue either you can roll the dice and disable SELinux permanently or find the proper way to fix it.

Did you compile python manually? if that the case, it's a whole different ball game. You might have to recompile python again with a whole slew of flags to get it to work.