Linux

安裝 mod_wsgi 錯誤 - config.status:錯誤:找不到輸入文件:Makefile.in

  • January 11, 2015

下面,我正在嘗試安裝 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版本,並決定手動進行,以便我知道正在安裝正確的版本。

根據上述錯誤,未安裝“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

謝謝

桑迪普

引用自:https://serverfault.com/questions/658666