我的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