我正在尝试安装一些模板语言以与 CherryPy 和 Python3 一起使用,但它们不会安装。Mako 和 Jinja2 都可以很好地安装到 Python 2 中,但是当我尝试为 Py3 安装它们时,它们会产生错误并且无法安装。他们给出了同样的错误:
TypeError: can't use a bytes pattern on a string-like object
我正在使用 Ubuntu 12.04、Python 3.2.3,并尝试安装 Mako 0.7.2 和 Jinja2。知道是否有安装它们的方法吗?如果没有,是否有一种很好的模板语言在 CherryPy w/Py3 中有用?
更新:这是我尝试时错误的整个 Tracebacksudo python3 setup.py install
Adding Mako 0.7.2 to easy-install.pth file
Traceback (most recent call last):
File "setup.py", line 61, in <module>
**extra
File "/usr/lib/python3.2/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.2/distutils/dist.py", line 917, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/install.py", line 73, in run
self.do_egg_install()
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/install.py", line 101, in do_egg_install
cmd.run()
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/easy_install.py", line 342, in run
self.easy_install(spec, not self.no_deps)
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/easy_install.py", line 562, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/easy_install.py", line 613, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/easy_install.py", line 641, in process_distribution
self.install_egg_scripts(dist)
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/easy_install.py", line 511, in install_egg_scripts
dist.get_metadata('scripts/'+script_name)
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/easy_install.py", line 735, in install_script
script_text = get_script_header(script_text) + (
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.13-py3.2.egg/setuptools/command/easy_install.py", line 1588, in get_script_header
match = first_line_re.match(first)
TypeError: can't use a bytes pattern on a string-like object