python - 从源代码安装 mod_wsgi 时出错

标签 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/

最佳答案

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

如果使用 MacOS X。

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

使用 pip 安装后,按照“连接到 Apache 安装”部分中说明的步骤将其挂接到 Apache。

关于python - 从源代码安装 mod_wsgi 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42604002/

相关文章:

python - 尝试更改我的网站正在使用的 Pylons 版本,但这会导致 DistributionNotFound 异常

python - OneDrive API Python SDK - 指向 login.live.com 而不是 mydomain.sharepoint.com

Python 正则表达式 [\d+]

Python Predict_proba 类识别

python - BeautifulSoup4 Python 3.4 抓取问题

html - 访问其他网站的htaccess

python - 在 Ubuntu 16.04 LTS 上使用 pgadmin4.15 和 apache 时出现内部服务器错误

python - Apache:重定向到 WSGI 脚本错误?

php - 从 PHP 将 Http 状态代码返回给 Apache?

python - 我如何在我的网络服务器上运行这个 python 脚本? TorBulkExitList.py