【问题标题】:compiling mod_wsgi in windows 8 is not working intending for django在 Windows 8 中编译 mod_wsgi 不适用于 django
【发布时间】:2015-07-06 17:52:49
【问题描述】:

我在开始时遇到了很多麻烦,这是我的规格

windows 8
64 bit
python 2.7
Apachehaus 2.4.12

我终其一生都无法弄清楚如何编译 mod_wsgi 以从源代码中生成必要的 mod_wsgi.so 文件。 https://github.com/GrahamDumpleton/mod_wsgi/releases

我正在尝试编译 ap24py27-win64-VC9.mk 并在打开 Visual C++ 2008 64 位命令提示符后

c:\mod_wsgi-4.4.13> nmake -f ap24py27-win64-VC9.mk
c:\mod_wsgi-4.4.13\src\server\wsgi_python.h(24) : fatal error 1083: Cannot open include file: 'Python.h': No such file or directory wsgi_restrict.c
c:\mod_wsgi-4.4.13\src\server\wsgi_python.h(24) : fatal error  1083: Cannot open include file: 'Python.h': No such file or directory wsgi_server.c
c:\python27\mod_wsgi-4.4.13\src\server\wsgi_python.h(24) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory wsgi_stream.c
c:\mod_wsgi-4.4.13\src\server\wsgi_python.h(24) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory wsgi_validate.c
c:\mod_wsgi-4.4.13\src\server\wsgi_python.h(24) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
Generating Code...
c:\mod_wsgi-4.4.13\src\server\wsgi_memory.c(124) : warning C4711: function 'getPeakRSS' selected for automatic inline expansion
c:\mod_wsgi-4.4.13\src\server\wsgi_memory.c(125) : warning C4711: function 'getCurrentRSS' selected for automatic inline expansion 
NMAKE : fatal error U1077: '"C:\Users\User\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.EXE"' : return code '0x2'
Stop.

我已经将路径设置为 path=%path% Python27/include,因为那是 Python.h 文件所在的位置。

我也试过

python setup install
Traceback (most recent call last):
    File "setup.py", line 139, 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.

【问题讨论】:

    标签: python c++ django apache mod-wsgi


    【解决方案1】:

    编译器不使用PATH 环境变量来查找头文件。通常它使用INCLUDE

    我认为你可以将它传递给 nmake,就像这样

    nmake INCLUDE=pathToPythonHeader -f ap24py27-win64-VC9.mk

    【讨论】:

    • 真的我今天试一试
    【解决方案2】:

    你为什么要从源代码编译它?为什么不使用预编译的二进制文件?

    在 Windows 上您真正需要的后一个版本中没有任何额外内容,因此只需获取并使用目前为 4.4.12 的最新二进制版本。

    您也不能在 Windows 上执行“python setup.py install”或“pip install”。

    如果您确实出于某种未知原因需要从源代码构建,您至少需要修改 ap24py27-win64-VC9.mk 文件并覆盖 Python 和 Apache 的安装位置。默认位置基于非标准布局,允许我同时为不同架构安装许多不同的 Python 和 Apache 版本。

    【讨论】:

    • 我需要的构建没有二进制文件。除非你能找到一个
    • 您是否阅读了 README 文件 github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/… 及其内容。从技术上讲,不可能获得一组完全兼容的对象二进制文件以满足您的需求。如果您选择忽略它并尝试,它会说使用可用二进制文件的 tar 球中的Apache24-win64-VC10/modules/mod_wsgi-py27-VC9.so。如果不是这样,你还期待什么?
    猜你喜欢
    • 1970-01-01
    • 2016-05-26
    • 2014-06-29
    • 2020-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    相关资源
    最近更新 更多