简体   繁体   English

无法在 Windows 10 上构建 mod_wsgi - “无法打开包含文件:'ws2tcpip.h'” - 有 VS 2019 构建工具

[英]Can't build mod_wsgi on Windows 10 - “Cannot open include file: 'ws2tcpip.h'” - Have VS 2019 Build tools

I have apache 2.4 installed (64 bit), python 3.7 (64 bit) (installed from Anaconda, if that matters) and VS 2019 C++ build tools, with the SDK and everything else required to build this checked. I have apache 2.4 installed (64 bit), python 3.7 (64 bit) (installed from Anaconda, if that matters) and VS 2019 C++ build tools, with the SDK and everything else required to build this checked. I still cannot build mod_wsgi with pip install.我仍然无法使用 pip 安装构建 mod_wsgi。 How can I get this to work on Windows 10?我怎样才能让它在 Windows 10 上工作?

I have tried uninstalling and reinstalling, python, visual studio & visual studio build tools, and apache.我已经尝试卸载并重新安装 python、visual studio 和 Visual Studio 构建工具以及 apache。 I have tried all the various visual studio command prompts.我已经尝试了所有各种 Visual Studio 命令提示符。 I have checked stack overflow, github, and other sites.我检查了堆栈溢出、github 和其他站点。 There were others with similar issues but the solution of installing build tools did not work for me because a.) I already had it, b.) I reinstalled everything and it still didn't work.还有其他人有类似的问题,但安装构建工具的解决方案对我不起作用,因为 a.) 我已经有了它,b.) 我重新安装了所有东西,但它仍然不起作用。

pip install mod_wsgi

Resulting error message:产生的错误信息:

Collecting mod_wsgi
  Using cached https://files.pythonhosted.org/packages/26/03/a3ed5abc2e66c82c40b0735c2f819c898d136879b00be4f5537126b6a4a4/mod_wsgi-4.6.7.tar.gz
Building wheels for collected packages: mod-wsgi
  Building wheel for mod-wsgi (setup.py) ... error
  ERROR: Complete output from command 'C:\Users\VC046230\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\VC046230\\AppData\\Local\\Temp\\pip-install-12r9v42f\\mod-wsgi\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\VC046230\AppData\Local\Temp\pip-wheel-1q_bver8' --python-tag cp37:
  ERROR: C:\Users\VC046230\AppData\Local\Continuum\anaconda3\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'bugtrack_url'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\mod_wsgi
  copying src\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi
  creating build\lib.win-amd64-3.7\mod_wsgi\server
  copying src\server\apxs_config.py -> build\lib.win-amd64-3.7\mod_wsgi\server
  copying src\server\environ.py -> build\lib.win-amd64-3.7\mod_wsgi\server
  copying src\server\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\server
  creating build\lib.win-amd64-3.7\mod_wsgi\server\management
  copying src\server\management\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\server\management
  creating build\lib.win-amd64-3.7\mod_wsgi\server\management\commands
  copying src\server\management\commands\runmodwsgi.py -> build\lib.win-amd64-3.7\mod_wsgi\server\management\commands
  copying src\server\management\commands\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\server\management\commands
  creating build\lib.win-amd64-3.7\mod_wsgi\docs
  copying docs\_build\html\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\docs
  creating build\lib.win-amd64-3.7\mod_wsgi\images
  copying images\__init__.py -> build\lib.win-amd64-3.7\mod_wsgi\images
  copying images\snake-whiskey.jpg -> build\lib.win-amd64-3.7\mod_wsgi\images
  running build_ext
  building 'mod_wsgi.server.mod_wsgi' extension
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\src
  creating build\temp.win-amd64-3.7\Release\src\server
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\Apache24/include -IC:\Users\VC046230\AppData\Local\Continuum\anaconda3\include -IC:\Users\VC046230\AppData\Local\Continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" /Tcsrc/server\mod_wsgi.c /Fobuild\temp.win-amd64-3.7\Release\src/server\mod_wsgi.obj
  mod_wsgi.c
  C:\Users\VC046230\AppData\Local\Temp\pip-install-12r9v42f\mod-wsgi\src\server\wsgi_apache.h(39): fatal error C1083: Cannot open include file: 'ws2tcpip.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for mod-wsgi

I just solved the same problem.我刚刚解决了同样的问题。 My config is Windows 10, Python 3.8.1, Apache2.4.39-Win64-VC15-OpenSSL1.1.1b, mod-wsgi 4.7.1.我的配置是 Windows 10,Python 3.8.1,Apache2.4.39-Win64-VC15-OpenSSL1。

1) I installed using Build Tools 1)我使用构建工具安装

  • Visual Studio Build Tools Main Components Visual Studio 构建工具主要组件
  • SDK for Windows 10 (10.0.18362.0) since I'm using Windows 10 SDK 用于 Windows 10 (10.0.18362.0) 因为我使用的是 Windows 10
  • MSVC 140 - C++ VS 2015 (v.14.00) MSVC 140 - C++ VS 2015 (v.14.00)

2) Then I added C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin to PATH 2)然后我将 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin 添加到PATH

3) Then I got the next error: 3)然后我得到下一个错误:

'apr_perms_set.h': No such file or directory'.

I downloaded the file and put it into $APACHE_DIR\include我下载了文件并将其放入 $APACHE_DIR\include

4) Then I got third error: 4)然后我得到第三个错误:

fatal error LNK1158: cannot run ‘rc.exe’.
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

I took following files rc.exe rcdll.dll from C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86 and paste them into C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin I took following files rc.exe rcdll.dll from C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86 and paste them into C:\Program Files (x86)\Microsoft Visual Studio 14.0\ VC\bin

5) Congratulations! 5)恭喜!

To anyone who had this issue, the following github issue helped me resolve it: https://github.com/GrahamDumpleton/mod_wsgi/issues/194对于遇到此问题的任何人,以下 github 问题帮助我解决了它: https://github.com/GrahamDumpleton/mod_wsgi/issues/194

I had already installed Visual C++ Redistributable, so I was confused why pip install mod_wsgi still was not working.我已经安装了 Visual C++ Redistributable,所以我很困惑为什么 pip install mod_wsgi 仍然无法正常工作。

All I ended up having to do was install Windows 10 SDK from https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/我最终要做的就是从https://developer.microsoft.com/en-us/windows/downloads/s安装 Windows 10 SDK

(might also need 8.1 if it still does not work) (如果它仍然不起作用,可能还需要 8.1)

暂无
暂无

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

相关问题 执行`pip install mod_wsgi`时`无法打开包含文件:'apr_perms_set.h'` - `Cannot open include file: 'apr_perms_set.h'` when doing `pip install mod_wsgi` 在Windows上为Apache VC11安装mod_wsgi - Installing mod_wsgi for apache VC11 build on windows 无法在Scientific Linux上为python2.7构建mod_wsgi - Cannot build mod_wsgi for python2.7 on Scientific Linux 无法打开包含文件:'io.h':没有这样的文件或目录,Python 3.7.5,Windows 8.1,VS v 2019 - Cannot open include file: 'io.h': No such file or directory, Python 3.7.5, Windows 8.1, VS v 2019 无法安装 matplotlib:致命错误 C1083:无法打开包含文件:'ft2build.h':没有这样的文件或目录 - Can't install matplotlib : fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory 在 Windows 上安装 Matplotlib 错误 - 无法打开包含文件 'ft2build.h' - Installing Matplotlib on Windows ERROR - cannot open include file 'ft2build.h' 从哪里获得/如何使用python 3.0支持构建mod_wsgi的Windows二进制文件? - Where to get/How to build Windows binary of mod_wsgi with python 3.0 support? 在Windows上的Apache下无法通过mod_wsgi导入pyodbc - Cannot import pyodbc via mod_wsgi under Apache on Windows 为什么mod_wsgi不支持Windows上的守护进程模式? - Why doesn't mod_wsgi support daemon mode on Windows? Matplotlib 构建问题:错误 C1083:无法打开包含文件:'ft2build.h' - Matplotlib Build Problem: Error C1083: Cannot open include file: 'ft2build.h'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM