为 python 安装 stringtemplate3
我尝试运行 Python/cminus 示例。 从http://pypi.python.org/pypi/stringtemplate3/3.1
,我使用sudo python setup.py install
为python安装了stringtemplate3。
当我运行以这段代码开头的 cminus.py 时。
import sys
import antlr3
import stringtemplate3
我有错误。
Traceback (most recent call last):
File "cminus.py", line 3, in <module>
import stringtemplate3
File "/Library/Python/2.7/site-packages/stringtemplate3/__init__.py", line 14, in <module>
from stringtemplate3.templates import *
File "/Library/Python/2.7/site-packages/stringtemplate3/templates.py", line 35, in <module>
import antlr
ImportError: No module named antlr
看起来 stringtemplate3 使用antlr而不是antlr3。
我该如何解决这个问题?
I tried to run Python/cminus example.
From http://pypi.python.org/pypi/stringtemplate3/3.1
, I installed stringtemplate3 for python with sudo python setup.py install
.
When I run cminus.py that starts with this code.
import sys
import antlr3
import stringtemplate3
I got errors.
Traceback (most recent call last):
File "cminus.py", line 3, in <module>
import stringtemplate3
File "/Library/Python/2.7/site-packages/stringtemplate3/__init__.py", line 14, in <module>
from stringtemplate3.templates import *
File "/Library/Python/2.7/site-packages/stringtemplate3/templates.py", line 35, in <module>
import antlr
ImportError: No module named antlr
It looks like that stringtemplate3 uses antlr not antlr3.
How can I solve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从此页面得到了答案 - 哪里可以获得 Python ANTLR 包使用 StringTemplate?
sudo python setup.py install
。我必须从antlr2.7安装antler
I got an answer from this page - Where to get Python ANTLR package to use StringTemplate?
sudo python setup.py install
.I had to install antler from antlr2.7