问题
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
I run
nmake -f win32-ap22py31.mk
But I get an error:
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
回答1:
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
First check where are Apache and Python installed and take those paths. You will need them to modify make file.
We use python 2.7 so directory paths are a little bit different than your version.
Open up win32-ap22py31.mk in text editor like Notepad++.
You will see lines like:
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"
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).
For libarary files:
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
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
Set python31.lib if not using python27.lib.
libhttpd.lib, libapr-1.lib and libaprutil-1.lib are libraries compiled during Apache2.2 build.
来源:https://stackoverflow.com/questions/18682741/nmake-error-trying-to-use-python-with-wamp