从源安装mod_wsgi时出错

时间:2017-03-05 03:02:35

标签: python apache mod-wsgi

我通过从源代码构建它来安装apr-1.5.2apr-util-1.5.4apr-iconv-1.2.1httpd-2.4.25。使用默认设置。但每次我尝试构建mod_wsgi时,它总是显示此错误。我尝试了其他答案,但没有任何帮助。

我正在使用python 3运行Mac OSX并安装了Xcode-select,正如安装指南所说的那样。但我没有Xcode(安装指南中没有说我需要)。我怎么能得不到这个错误?

$./configure
checking for apxs2... no
checking for apxs... /usr/sbin/apxs
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
cat: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/share/apr-1/build-1/libtool: No such file or directory
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for prctl... no
checking Apache version... apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
2.4.23
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
configure: creating ./config.status
config.status: creating Makefile

如果我使用pip,我也会得到同样的错误......

$pip3 install mod_wsgi
Collecting mod_wsgi
  Using cached mod_wsgi-4.5.14.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/7l/3hjlgnpj3mdf61ptzzdwtzf80000gn/T/pip-build-yvl7rbe8/mod-wsgi/setup.py", line 298, in <module>
        APR_INCLUDES = get_apr_includes().split()
      File "/private/var/folders/7l/3hjlgnpj3mdf61ptzzdwtzf80000gn/T/pip-build-yvl7rbe8/mod-wsgi/setup.py", line 259, in get_apr_includes
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 707, in __init__
        restore_signals, start_new_session)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1326, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7l/3hjlgnpj3mdf61ptzzdwtzf80000gn/T/pip-build-yvl7rbe8/mod-wsgi/

2 个答案:

答案 0 :(得分:1)

使用pip可安装的mod_wsgi,如下所述:

如果使用MacOS X。

您无法再在MacOS X上使用config / make / make install方法,因为Apple不再提供其工作所需的位。

使用pip安装后,请按照&#34;连接到Apache安装&#34;部分中的说明执行操作。把它挂钩到Apache。

答案 1 :(得分:0)

您也可以使用homebrew进行安装。使用以下命令。它将安装所有依赖项,最后安装mod_wsgi

brew install mod_wsgi --with-brewed-httpd24