我的Windows 2.7系统上安装了Python 2.7与Cheetah。下面是我得到的错误,当我尝试使用.tmpl文件中的cheetah.template对象。我在哪里可以得到以及如何在Windows上为Python 2.7安装_namemapper.pyd
from Cheetah.Template import Template
t = Template(file='home.tmpl')
C:\wamp\bin\Python27\lib\site-packages\Cheetah\Compiler.py:1509: UserWarning:
You don't have the C version of NameMapper installed! I'm disabling Cheetah's us
eStackFrames option as it is painfully slow with the Python version of NameMappe
r. You should get a copy of Cheetah with the compiled C version of NameMapper.
"\nYou don't have the C version of NameMapper installed! "
from Cheetah.Template import Template
t = Template(file='home.tmpl')
print t
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\wamp\bin\Python27\lib\site-packages\Cheetah\Template.py", line 1005,
in __str__
rc = getattr(self, mainMethName)()
File "_wamp_www_b121pyraw_b121pycheetah_home_tmpl.py", line 89, in respond
File "C:\wamp\bin\Python27\lib\site-packages\Cheetah\NameMapper.py", line 246,
in valueFromSearchList
_raiseNotFoundException(key, searchList)
File "C:\wamp\bin\Python27\lib\site-packages\Cheetah\NameMapper.py", line 167,
in _raiseNotFoundException
raise NotFound(excString)
Cheetah.NameMapper.NotFound: cannot find 'firstdivcontents'
我搜索了python 2.7的_namemapper.pyd,但我没有得到。我发现只有2.6以上的文件。 我必须降级到Python 2.6,还是有其他方法来安装它。
以及如何安装_namemapper.pyd与蟒蛇的工作,如果在所有我找到它?
这只是一个警告,将使用非C版本的namemapper。在我看来,注释掉这个警告是相当愚蠢的建议 - 你可以简单地忽略这个警告,使用python版本的namemapper会使性能变差。所以降低了这个答案。 – DEzra 2013-04-15 18:15:59