apache 从哪里获取/如何使用 python 3.0 支持构建 mod_wsgi 的 Windows 二进制文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/447015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where to get/How to build Windows binary of mod_wsgi with python 3.0 support?
提问by Paulius
I wanted to experiment a little with python 3.0 at home. I got python 3.0 working, I've played around with some scripts, and I thought it would be fun to try to make a small web-project with it.
我想在家里用 python 3.0 做一些实验。我让 python 3.0 运行起来,我玩过一些脚本,我认为尝试用它制作一个小的 web 项目会很有趣。
As I was googling, it turned out, that mod_python, for some reasons, will not be able to support python 3.0.
当我在谷歌上搜索时,结果证明,由于某些原因,mod_python 将无法支持 python 3.0。
The only other alternative I've found is mod_wsgi.
我发现的唯一其他选择是mod_wsgi。
On the main page of the mod_wsgiproject, it says, that if you want to play with python 3.0, you have to get the latest version from subversion repository. I was wondering, if there is somewhere a pre-built windows binaries available?
在mod_wsgi项目的主页上,它说,如果你想玩 python 3.0,你必须从 subversion 存储库中获取最新版本。我想知道,是否有可用的预构建 Windows 二进制文件?
If there are no such binaries, then I'd be thankful for any resources about building it with VC++ 2008. Or maybe even general resources about building apache and it's modules with VC++ 2008. Thanks.
如果没有这样的二进制文件,那么我会感谢有关使用 VC++ 2008 构建它的任何资源。或者甚至可能是关于使用 VC++ 2008 构建 apache 及其模块的一般资源。谢谢。
Oh and, I'm using the latest Apache 2.2 release.
哦,我使用的是最新的 Apache 2.2 版本。
EDIT: Will it be a problem, if I'll be using the official apache build with my own build of a mod_wsgi (I used depends.exe on apache, and seems that it's not built with VC++ 2008)?
编辑:如果我将官方 apache 版本与我自己的 mod_wsgi 版本一起使用(我在 apache 上使用了depends.exe,似乎它不是用 VC++ 2008 构建的),会不会有问题?
回答by Graham Dumpleton
Binaries for Windows are now being supplied from the mod_wsgi site for Apache 2.2 and Python 2.6 and 3.0. Python 3.0 is only supported for mod_wsgi 3.0 onwards. See:
用于 Windows 的二进制文件现在由 mod_wsgi 站点提供,用于 Apache 2.2 和 Python 2.6 和 3.0。Python 3.0 仅支持 mod_wsgi 3.0 以上。看:
http://code.google.com/p/modwsgi/downloads/list
http://code.google.com/p/modwsgi/downloads/list
UPDATE July 2015
2015 年 7 月更新
The above link is no longer valid. Instead see:
上面的链接不再有效。而是看到:
回答by kquinn
I would like to find either 2.6 (preferable) or 3.0 (okay) Windows binaries myself, and have looked into this a bit.
我想自己找到 2.6(最好)或 3.0(好的)Windows 二进制文件,并对此进行了一些研究。
There are Windows build steps for mod_wsgi buried deep in the Google Group for it. I think they're out of date; only one person appears to have ever done it and told the world how well it worked out. There may well be problems compiling that require a patch.
mod_wsgi 的 Windows 构建步骤深埋在 Google Group 中。我认为它们已经过时了;似乎只有一个人做过这件事,并告诉全世界它的效果如何。很可能存在需要补丁的编译问题。
I do not think you will need to build your own Apache, or if it matters that the VC++ version is different (though I don't have a ton of evidence for this belief). VC++ version is very important for Python module builds since they rely heavily on the internals of the compiler data structures. I think the Apache module interface is more structured.
我认为您不需要构建自己的 Apache,或者 VC++ 版本是否不同(尽管我没有大量证据支持这种信念)。VC++ 版本对于 Python 模块构建非常重要,因为它们严重依赖编译器数据结构的内部结构。我认为 Apache 模块接口更加结构化。
You'll probably want to post to the mod_wsgi group if you try this and hit problems, or if you successfully build the modules, please post them as some of us would very much like them but are too busy to get to doing it ourselves :(
如果您尝试这样做并遇到问题,或者如果您成功构建模块,您可能想要发布到 mod_wsgi 组,请发布它们,因为我们中的一些人会非常喜欢它们但太忙而无法自己做: (
回答by cethegeek
For what it is worth, this is still (as of March 2nd 2008) up in the air as far as I can tell. See:
就其价值而言,据我所知,这仍然(截至 2008 年 3 月 2 日)悬而未决。看:
http://groups.google.com/group/modwsgi/browse_thread/thread/93e5e56a04fe37ab/5883f8f6a0fcc945
http://groups.google.com/group/modwsgi/browse_thread/thread/93e5e56a04fe37ab/5883f8f6a0fcc945
The same issue - lack of 2.6 binaries for windows - affects mod_python.
同样的问题——Windows 缺少 2.6 二进制文件——影响 mod_python。
I think this pretty much leaves Django users running on Windows locked onto the 2.5 tree... :-(
我认为这几乎让在 Windows 上运行的 Django 用户锁定在 2.5 树上...... :-(
回答by roman
I was able to build mod_wsgi for python 2.54 (my python is 2.5 therefore i have to use MSVC7). Using xampp Apache 2.2.14 (it is just a dev machine, for testing purposes):
我能够为 python 2.54 构建 mod_wsgi(我的 python 是 2.5,因此我必须使用 MSVC7)。使用 xampp Apache 2.2.14(它只是一个开发机器,用于测试目的):
Instructions:
指示:
- download http://adal.chiriliuc.com/temp/win32.zip
- unpack eg. c:/tmp/modwsgi/win32
- download and upack mod_wsgi http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.2.tar.gz&can=2&q=into c:/tmp/modwsgi
- edit the c:/tmp/modwsgi/win32/generate.py
- must set correct paths
- i also commented out the parts for python24
- then cd c:/tmp/modwsgi/win32
- python generate.py
- build.bat
- 下载http://adal.chiriliuc.com/temp/win32.zip
- 打开包装,例如。c:/tmp/modwsgi/win32
- 下载并打包 mod_wsgi http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.2.tar.gz&can=2&q=到 c:/tmp/modwsgi
- 编辑 c:/tmp/modwsgi/win32/generate.py
- 必须设置正确的路径
- 我还注释掉了 python24 的部分
- 然后 cd c:/tmp/modwsgi/win32
- 蟒蛇生成.py
- 编译.bat
and you can copy mod_wsgi.so to your apache
你可以将 mod_wsgi.so 复制到你的 apache
The relevant part of the generate.py for my settings was:
我的设置的 generate.py 的相关部分是:
##### BUILD MACHINE CONFIG #####
VS2003_PATH = r"C:\Program Files\Microsoft Visual Studio .NET 2003"
PYTHON_PATH = {
# Put None or comment/delete the entry if a particular version is not present
#24: r"C:\Python24",
25: r"C:\dev\Python254",
}
APACHE_PATH = {
# Put None or comment/delete the entry if a particular version is not present
#20: r"c:\dev\xampp\apache",
22: r"c:\dev\xampp\apache",
}
##### BUILD MACHINE CONFIG #####
APACHE_LIBS = {
#20: "libhttpd.lib libapr.lib libaprutil.lib",
22: "libhttpd.lib libapr-1.lib libaprutil-1.lib",
}

