我打算在 Windows 中使用 wsgi + mako。
我使用
安装 makoC:\wsgi>c:\Python26\Scripts\easy_install.exe Mako
没有错误。我明白了
Finished processing dependencies for Mako
在消息的结尾。
我检查我的 Python 目录,我有以下结构:
C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg
C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg\EGG-INFO
C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg\mako
C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg\mako\ext
我运行以下代码 HelloWorld.py
from mako.template import Template
def application(environ, start_response):
status = '200 OK'
mytemplate = Template("hello, ${name}!")
output = mytemplate.render(name="jack")
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
我收到以下错误日志:
[Fri Feb 05 16:11:19 2010] [error] [client 127.0.0.1] File "C:/wsgi/HelloWorld.py", line 1, in <module>
[Fri Feb 05 16:11:19 2010] [error] [client 127.0.0.1] from mako.template import Template
[Fri Feb 05 16:11:19 2010] [error] [client 127.0.0.1] ImportError: No module named mako.template
有什么建议吗?
请您参考如下方法:
一些尝试
- 确保你使用的是 python2.6
- 尝试
import mako看看你是否得到类似的错误 - 如果 mako 导入正确,请查看
repr(mako)的值并确保它与您的路径相对应。
