在 windows 和 python 2.6.1 中使用 Cheetah 模板系统(namemapper 问题)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1155065/
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
Using Cheetah Templating system with windows and python 2.6.1 (namemapper problem)
提问by Daniel Waltrip
So I am trying to use the Cheetah templating engine in conjunction with the Django web framework, and that is actually working fine. I did some simple tests with that and I was able to render pages and whatnot.
所以我尝试将 Cheetah 模板引擎与 Django Web 框架结合使用,这实际上工作正常。我用它做了一些简单的测试,我能够渲染页面等等。
However, problems arise whenever doing anything other than using very simple variable/attribute/methods in the Cheetah templates. It gets mad and says: You don't have the C version of NameMapper installed! I'm disabling Cheetah's useStackFrames option as it is painfully slow with the Python version of NameMapper. You should get a copy of Cheetah with the compiled C version of NameMapper. "\nYou don't have the C version of NameMapper installed! "
然而,只要在 Cheetah 模板中使用非常简单的变量/属性/方法以外的任何其他方式,就会出现问题。它生气地说:你没有安装 NameMapper 的 C 版本!我正在禁用 Cheetah 的 useStackFrames 选项,因为使用 NameMapper 的 Python 版本速度非常慢。你应该得到一份带有 NameMapper 编译后的 C 版本的 Cheetah 副本。"\n你没有安装 C 版本的 NameMapper!"
And then it will be unable to find whatever attribute or method I was trying to call inside the Cheetah template.
然后它将无法找到我试图在 Cheetah 模板中调用的任何属性或方法。
I attempted to download the C version of Namemapper and install it, but I wasn't sure how to 'install' a .pyd file (when I looked up '.pyd' files on the web it said they are just dynamic python modules that can be used with an import statement). Additionally, the Cheetah website only has C versions of Namemapper for python 2.4 and 2.5, while I am using python 2.6.1, so that is probably an issue as well.
我试图下载 Namemapper 的 C 版本并安装它,但我不确定如何“安装”一个 .pyd 文件(当我在网上查找“.pyd”文件时,它说它们只是动态 python 模块,可以与导入语句一起使用)。此外,Cheetah 网站只有用于 python 2.4 和 2.5 的 Namemapper 的 C 版本,而我使用的是 python 2.6.1,所以这也可能是一个问题。
Does anyone have a solution for this? Thanks.
有没有人对此有解决方案?谢谢。
回答by feisley
I have compiled the PYD file for Python 2.6 as well as Windows installers that have it bundled in, so that users don't have to figure out where to drop the PYD on Windows.
我已经为 Python 2.6 以及捆绑了它的 Windows 安装程序编译了 PYD 文件,这样用户就不必弄清楚在 Windows 上放置 PYD 的位置。
Installers: http://feisley.com/python/cheetah/(pyd files are in the /pyd folder)
安装程序:http://feisley.com/python/cheetah/(pyd 文件在 /pyd 文件夹中)
Hope this helps!
希望这可以帮助!