简体   繁体   中英

httpd and mod_wsgi ran with wrong python version

I am deploying a Django project with httpd on RHEL7 . And changed the system default python version to python 3.4. But after I restarted the httpd, it still used python 2.7.

I searched a lot and it is mostly because mod_wsgi was built under the wrong python version. However, I checked that mod_wsgi was installed under python 3.4.

May I know how to make it run under the correct python version? Not too sure if httpd has a default python version. Thanks very much for your help!

Error Stack trace: No module named embed

I just find that it was due to the fact that I didn't Load 'wsgi_module' to the httpd conf file. I just followed the instruction https://github.com/GrahamDumpleton/mod_wsgi to add LoadModule into httpd.conf file. It solves my problem and now runs in the correct python version!

 LoadModule wsgi_module "/usr/lib64/python3.4/site-packages/mod_wsgi/server/mod_wsgi-py34.cpython-34m.so"  
 WSGIPythonHome "/usr"  

But I think it is strange that it will show module wsgi_module is already loaded,skipping . If I comment these lines, it will again run in python2.7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM