Installing mod-wsgi in centos7 via pip3 throws "ERROR: Command errored out with exit status 1"

Installing mod-wsgi in centos7 via pip3 throws "ERROR: Command errored out with exit status 1"

下面是使用pip工具安装mod-wsgi时出现的错误。

[root@localhost ~]# pip3 install mod-wsgi

Collecting mod-wsgi   Downloading https://files.pythonhosted.org/packages/a0/8b/34dd82c3e15a031e9c89f5a5d2ca527ec35b7a01e1e7530abb61ffdb4d60/mod_wsgi-4.7.0.tar.gz (497kB)
     |████████████████████████████████| 501kB 111kB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-72ufrkfx/mod-wsgi/setup.py'"'"';
__file__='"'"'/tmp/pip-install-72ufrkfx/mod-wsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-72ufrkfx/mod-wsgi/pip-egg-info
         cwd: /tmp/pip-install-72ufrkfx/mod-wsgi/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-72ufrkfx/mod-wsgi/setup.py", line 168, in <module>
        'missing Apache httpd server packages.' % APXS)
    RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.
    ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

官方 mod-wsgi 安装页面中给出了系统要求的详细信息 - https://pypi.org/project/mod-wsgi/

由于我的系统是centos7,所以我安装了以下软件包来解决这个问题。

yum install httpd httpd-devel -y

[root@localhost ~]# pip3 install mod-wsgi

Collecting mod-wsgi
  Using cached https://files.pythonhosted.org/packages/a0/8b/34dd82c3e15a031e9c89f5a5d2ca527ec35b7a01e1e7530abb61ffdb4d60/mod_wsgi-4.7.0.tar.gz
Installing collected packages: mod-wsgi
    Running setup.py install for mod-wsgi ... done
Successfully installed mod-wsgi-4.7.0