nmake 错误(尝试在 WAMP 中使用 Python) [英] nmake error (trying to use Python with WAMP)

查看:41
本文介绍了nmake 错误(尝试在 WAMP 中使用 Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Windows 7 64x.我已经安装了 Python 3.3.2.我已经从 http://code.google.com/p/modwsgi/wiki/DownloadTheSoftware?tm=2 下载了 MOD_WSGI我现在正在尝试按照本教程进行操作:http://code.google.com/p/modwsgi/wiki/InstallationOnWindows

Using Windows 7 64x. I've installed Python 3.3.2. I've downloaded MOD_WSGI from http://code.google.com/p/modwsgi/wiki/DownloadTheSoftware?tm=2 I'm now trying to follow this tutorial: http://code.google.com/p/modwsgi/wiki/InstallationOnWindows

我跑

nmake -f win32-ap22py31.mk

但我收到一个错误:

cl /DWIN32  /DNDEBUG  /I"c:\Program Files\Microsoft Visual Studio 9.0\VC\include"  /I"c:\Program Files\Microsoft SDKs\Windows\v6.0A\Include"  /I"c:\Program Files\Apache Software Foundation\Apache2.2\include"  /I"c:\Python31\include" /MD  /GF  /Gy  /O2  /Wall  /Zc:wchar_t  /Zc:forScope mod_wsgi.c /LD /link  "/LIBPATH:c:\Program Files\Microsoft Visual Studio 9.0\VC\lib"  "/LIBPATH:c:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib"  "/LIBPATH:c:\Program Files\Apache Software Foundation\Apache2.2\lib"  /LIBPATH:c:\Python31\libs  /OPT:REF  /OPT:ICF=2  /RELEASE  /SUBSYSTEM:WINDOWS python31.lib  libhttpd.lib  libapr-1.lib  libaprutil-1.lib /OUT:mod_wsgi.so
mod_wsgi.c
mod_wsgi.c(34) : fatal error C1083: Cannot open include file: 'httpd.h': No such file or directory

推荐答案

这是 mod_wsgi make 文件中的配置问题.在构建 win32-ap22py31.mk 时,nmake 需要知道正确的 Apache 和 Python 包含和库路径.之后,nmake 知道在哪里编译和链接输出 mod_wsgi.so 所需的目标文件

This is a problem with configuration in mod_wsgi make file. When building win32-ap22py31.mk, nmake needs to know proper Apache and Python include and library paths. After that nmake knows where to compile and link object files needed to output mod_wsgi.so

首先检查 Apache 和 Python 的安装位置并选择这些路径.您将需要它们来修改 make 文件.

First check where are Apache and Python installed and take those paths. You will need them to modify make file.

我们使用 python 2.7,因此目录路径与您的版本略有不同.

We use python 2.7 so directory paths are a little bit different than your version.

在 Notepad++ 等文本编辑器中打开 win32-ap22py31.mk.

Open up win32-ap22py31.mk in text editor like Notepad++.

你会看到如下几行:

CPPFLAGS = \
 /DWIN32 \
 /DNDEBUG \
 /I"c:\Program Files\Microsoft Visual Studio 9.0\VC\include" \
 /I"c:\Program Files\Microsoft SDKs\Windows\v6.0A\Include" \
 /I"C:\apache2.2\include" \
 /I"C:\Python27\PC" 

在这里您应该设置路径以包含来自 apache 和 python 安装的 make 文件使用的文件.它们以/I 指令开头,如果将命令传输到下一行,则应以\"结尾.如果您需要更多包含路径,也可以在此处添加它们.不要在目录路径末尾添加\",因为它可能会破坏构建并且您将收到构建错误.还要检查包含行是否适合您安装的 VC++ 和 SDK(前两行).

Here you should set path to include files used by make file from apache and python installations. They start with /I directive and should end with "\" if you transfer command to next line. If you need more include paths, add them here too. Do not add "\" at end of directory path as it will probably break build and you will get build error. Also check if include lines are proper for your installation of VC++ and SDK (first two lines).

对于库文件:

LDFLAGS = \
 /link \
 "/LIBPATH:c:\Program Files\Microsoft Visual Studio 9.0\VC\lib" \
 "/LIBPATH:c:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" \
 "/LIBPATH:C:\apache2.2\lib" \
 "/LIBPATH:C:\Python27\PCbuild" \
 /OPT:REF \
 /OPT:ICF=2 \
 /RELEASE \
 /SUBSYSTEM:WINDOWS

在这里,您应该使用/LIBPATH 指令而不是/I 添加库路径.

Here you should add library paths with /LIBPATH directive instead of /I.

对于使用过的库,请更改以下命令:

And for the used libraries change following command:

LDLIBS = \
 python27.lib \
 libhttpd.lib \
 libapr-1.lib \
 libaprutil-1.lib

如果不使用 python27.lib,则设置 python31.lib.

Set python31.lib if not using python27.lib.

libhttpd.lib、libapr-1.lib 和 libaprutil-1.lib 是在 Apache2.2 构建期间编译的库.

libhttpd.lib, libapr-1.lib and libaprutil-1.lib are libraries compiled during Apache2.2 build.

这篇关于nmake 错误(尝试在 WAMP 中使用 Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆