简体   繁体   English

执行`pip install mod_wsgi`时`无法打开包含文件:'apr_perms_set.h'`

[英]`Cannot open include file: 'apr_perms_set.h'` when doing `pip install mod_wsgi`

I am trying to roll out a production Django environment on Windows 10 with Apache 2.4.37 x64 OpenSSL 1.1.1 VC14 from ApacheHaus .我正在尝试使用 ApacheHaus 的 Apache 2.4.37 x64 OpenSSL 1.1.1 VC14在 Windows 10 上推出生产 Django 环境。 However, when following these instructions , I'm getting the following error:但是,按照这些说明进行操作时,出现以下错误:

  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:/Servers/Web/Apache/Apache24/include -Ic:\programs\python37\include -Ic:\programs\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/server\mod_wsgi.c /Fobuild\temp.win-amd64-3.7\Release\src/server\mod_wsgi.obj
  mod_wsgi.c
  d:\servers\web\apache\apache24\include\apr_network_io.h(29): fatal error C1083: Cannot open include file: 'apr_perms_set.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for mod-wsgi

I see the following options to C/C++ compiler: -ID:/Servers/Web/Apache/Apache24/include -Ic:\\programs\\python37\\include .我看到 C/C++ 编译器的以下选项: -ID:/Servers/Web/Apache/Apache24/include -Ic:\\programs\\python37\\include So it seems include file apr_perms_set.h is missing from Apache or Python.因此,Apache 或 Python 中似乎缺少包含文件apr_perms_set.h

How to fix this error with the correct versions of the include files?如何使用正确版本的包含文件修复此错误? I'm afraid it's wrong to just take the latest version from a repository because it may not match what's Apache or mod-wsgi expect.恐怕仅从存储库中获取最新版本是错误的,因为它可能与 Apache 或 mod-wsgi 期望的不匹配。

I had similar error on Windows Server 2016, when trying to use Apache 2.4 64bit with Python 2.7.当我尝试将 Apache 2.4 64 位与 Python 2.7 一起使用时,我在 Windows Server 2016 上遇到了类似的错误。 Apparently apr header files were missing.显然 apr 头文件丢失了。 I was able to solve it by:我能够通过以下方式解决它:

  • making sure I have both Apache and Python 64bit (guess it'll be valid for 32bit as well) installing VC++ Redistributable - of course 64bit in my case确保我同时拥有 Apache 和 Python 64 位(猜测它也适用于 32 位)安装VC++ Redistributable - 在我的情况下当然是 64 位
  • downloading Apache Runtime (apr) headers from APR project websiteAPR 项目网站下载 Apache Runtime (apr) 头文件
  • copying missing header file from downloaded sources into Apache's include folder将丢失的头文件从下载的源文件复制到 Apache 的包含文件夹中
  • installing mod_wsgi with pip install mod_wsgi (inside my virtual environment).与安装mod_wsgi的pip install mod_wsgi (我的虚拟环境中)。

The distribution from The Apache Haus does not include the aforementioned header file for some strange reason.由于某些奇怪的原因,Apache Haus 的发行版不包含上述头文件。 Try using the distribution from Apache Lounge , it should contain all header files needed to compile mod_wsgi (tested with httpd-2.4.41-win32-VS16.zip).尝试使用Apache Lounge的发行版,它应该包含编译 mod_wsgi 所需的所有头文件(使用 httpd-2.4.41-win32-VS16.zip 测试)。

可以从Github下载丢失的文件,复制到目录下

C:/Apache24/include

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM