下面,我正在尝试安装 mod_wsgi。
[root@server]# ./configure --with-python=/usr/local/bin/python2.7
checking for apxs2... no
checking for apxs... no
checking Apache version... ./configure: line 1704: apxs: command not found
./configure: line 1704: apxs: command not found
./configure: line 1705: apxs: command not found
./configure: line 1708: /: is a directory
./configure: line 1877: apxs: command not found
configure: creating ./config.status
config.status: error: cannot find input file: Makefile.in
我正在按照教程这里安装适用于 Python 2.7 的 mod_wsgi。我让 virtualenv 与 Django 安装一起工作,但是我收到了 500 错误,它记录了以下内容:
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] mod_wsgi (pid=1314): Target WSGI script '/var/www/virtualenv-2.7/mysite/mysite/wsgi.py' cannot be loaded as Python module.
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] mod_wsgi (pid=1314): Exception occurred processing WSGI script '/var/www/virtualenv-2.7/mysite/mysite/wsgi.py'.
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] Traceback (most recent call last):
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] File "/var/www/virtualenv-2.7/mysite/mysite/wsgi.py", line 13, in <module>
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] from django.core.wsgi import get_wsgi_application
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] File "/var/www/virtualenv-2.7/lib/python2.7/site-packages/django/core/wsgi.py", line 2, in <module>
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] from django.core.handlers.wsgi import WSGIHandler
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] File "/var/www/virtualenv-2.7/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 11, in <module>
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] from django import http
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] File "/var/www/virtualenv-2.7/lib/python2.7/site-packages/django/http/__init__.py", line 2, in <module>
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] from django.http.request import (HttpRequest, QueryDict,
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] File "/var/www/virtualenv-2.7/lib/python2.7/site-packages/django/http/request.py", line 11, in <module>
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] from django.conf import settings
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] File "/var/www/virtualenv-2.7/lib/python2.7/site-packages/django/conf/__init__.py", line 9, in <module>
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] import importlib
[Sat Jan 10 21:50:06 2015] [error] [client 182.118.60.114] ImportError: No module named importlib
同时,python
virtualenv 中有 1.7 版本,并且import django
运行良好。因此我决定卸载已安装的mod_wsgi
版本yum
,并决定手动执行此操作,以便我知道安装的是正确的版本。
答案1
根据上述错误,“apxs”二进制文件未安装。
apxs 是用于为 Apache 超文本传输协议 (HTTP) 服务器构建和安装扩展模块的工具。这是通过从一个或多个源文件或目标文件构建动态共享对象 (DSO) 来实现的,然后可以通过 mod_so 中的 LoadModule 指令在运行时将其加载到 Apache 服务器中。
[http://httpd.apache.org/docs/2.2/programs/apxs.html][1]
执行以下命令并验证 mod_so 是否已安装。
httpd-l
通过查询检查我们是否安装了 httpd-devel,如果没有安装,请使用 yum 进行安装。
rpm -qa | grep httpd-devel
谢谢
桑迪普