将mod_wsgi从python3.5更改为3.6 [英] Change mod_wsgi from python3.5 to 3.6

查看:432
本文介绍了将mod_wsgi从python3.5更改为3.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个flask应用程序,该应用程序过去曾在apache2上与python3.5一起运行. 我现在正尝试将其更改为在3.6上运行(我的代码仅在3.6上支持我的提示类型).

我已经为python3.6安装了模块,但是当尝试重新启动apache并运行我的应用程序时,它失败了.
运行时

I have a flask app that used to run with python3.5 on apache2. I am now trying to change it to run on 3.6 (i have sone type hinting in my code that is only supported on 3.6).

I have installed the module for python3.6, but when tried to restart apache and run my app, it fails.
When running

mod_wsgi-express module-location

我有python3.5版本

I have the python3.5 version

/usr/local/lib/python3.5/dist-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so

同一文件也存在于我的服务器上的python3.6目录中.
我还更改了$ PATH,以将python3.6作为python的默认运行.
我如何告诉apache在python3.6而不是3.5上运行?

The same file also existis on my server in python3.6 dir.
I also changed my $PATH to run python3.6 as a default for python.
How can I tell apache to run on python3.6 and not on 3.5?

推荐答案

WOHA!工作正常!
我卸载了mod_wsgi(sudo apt get remove libapache2-mod-wsgi). 然后,通过pip专门将模块安装到python3.6(python3.6 -m pip install mod_wsgi),但此时apache仍运行python3.5.
我添加到apache配置文件(在ubunutu 16.4中,该文件位于:对于RHEL/CentOS 7,/etc/apache2/apache2.conf/usr/local/lib64/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so)如下:
LoadModule wsgi_module "/usr/local/lib/python3.6/dist-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"

WSGIPythonHome "/usr"做到了.
我在这个问题上哭了很多,找到了apache2.conf文件等,因此希望对任何人都有帮助.

WOHA! It's working!
I uninstalled the mod_wsgi (sudo apt get remove libapache2-mod-wsgi). Then, Installed the module via pip specifically to python3.6 (python3.6 -m pip install mod_wsgi), but at this point the apache still ran python3.5.
I added to the apache configuration file (in ubunutu 16.4 the file is located at: /etc/apache2/apache2.conf and /usr/local/lib64/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so for RHEL/CentOS 7) the followings:
LoadModule wsgi_module "/usr/local/lib/python3.6/dist-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"
and
WSGIPythonHome "/usr" and that did the trick.
I weeped a lot of tears over this issue, finding the apache2.conf file etc, so hopefully this will be helpful to anyone.

这篇关于将mod_wsgi从python3.5更改为3.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆