问题原文
原帖链接 · Shan · CC BY-SA 3.0
I have a site say site.com/weather/a1.py
When I try to execute this file, this shows the version of Python as 2.6 whereas If I execute it by logging into terminal via Putty it shows me the Python version as 3.6
Can some one educate me on how to use Python3.6 for files executed via cgi-bin also?
Note : I recently changed my Python version using here
已采纳解答
原帖链接 · Vaibhav Panmand · CC BY-SA 3.0
You must have mod_wsgi apache module for 2.6 in apache that is why apache refer to older python version. You can install newer version of mod_wsgi using below commands.
Redhat / Centos
List available mod_wsgi versions
yum list *mod_wsgi*
Select correct version and install with yum.
yum install python36u-mod_wsgi
Ubuntu
sudo apt-get -y install libapache2-mod-wsgi-py3
Reatsrt apache after successful installation, then it will load python version 3.x in apache configuration.
Specifically for CentOS
After doing above you need to do these also
1.Remove mod_python.so from apache httpd.conf
2.python.conf might be available either in /etc/httpd/conf or /etc/http/conf.d
3.Comment out all the lines in it
4.Add WSGI alias as mentioned over [here][1]
5.Then restart apache
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
