Mod_Wsgi PythonHome不起作用

2 投票
1 回答
9868 浏览
提问于 2025-04-18 05:24

我犯了个错误,装了一个 Ubuntu Server(12.04)。我安装了 Python3 和对应的 mod_wsgi。

Apache2 启动了,但留下了以下错误日志:

[Mon May 05 11:00:24 2014] [error] python_init: Python version mismatch, expected '2.7.2+', found '2.7.3'.
[Mon May 05 11:00:24 2014] [error] python_init: Python executable found '/usr/bin/python'.
[Mon May 05 11:00:24 2014] [error] python_init: Python path being used '/usr/lib/python2.7/:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/$
[Mon May 05 11:00:24 2014] [notice] mod_python: Creating 8 session mutexes based on 80 max processes and 0 max threads.
[Mon May 05 11:00:24 2014] [notice] mod_python: using mutex_directory /tmp
[Mon May 05 11:00:24 2014] [warn] mod_wsgi: Compiled for Python/3.2.2+.
[Mon May 05 11:00:24 2014] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Mon May 05 11:00:24 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.11 with Suhosin-Patch mod_python/3.3.1 Python/2.7.3 mod_wsgi/3.3 configured$
[Mon May 05 11:00:25 2014] [notice] child pid 10860 exit signal Segmentation fault (11)
[Mon May 05 11:00:25 2014] [notice] child pid 10861 exit signal Segmentation fault (11)
[Mon May 05 11:00:25 2014] [notice] child pid 10863 exit signal Segmentation fault (11)
[Mon May 05 11:00:27 2014] [notice] child pid 10864 exit signal Segmentation fault (11)
[Mon May 05 11:00:27 2014] [notice] child pid 10865 exit signal Segmentation fault (11)

这是我的 WSGI.conf 文件:

<IfModule mod_wsgi.c>

WSGIPythonHome /usr/bin/python3.2
WSGIPythonPath /home/user/.virtualenvs/my_env/lib/python3.2/site-packages/

</IfModule>

我已经搜索了两个小时,什么都没找到,所以我很想换个服务器操作系统,但重新上传和解析比特币区块链至少要花一天时间。

1 个回答

6

WSGIPythonHome这个设置不会起作用,因为你同时在Apache中加载了mod_python。在这种情况下,mod_python会覆盖你使用的Python版本。

这个问题在WSGIPythonHome的文档中有提到。

你还可以阅读:

另外,WSGIPythonHome本来就不应该设置为Python可执行文件的路径。所以即使你只使用mod_wsgi,这个设置也会被完全忽略。

所以,如果你不需要mod_python,就不要在Apache中加载它。

撰写回答