我试图将antlr4导入到python3代码中,但是我获得了以下错误:
$ python3 test.py
Traceback (most recent call last):
File "test.py", line 3, in <module>
import antlr4
ImportError: No module named 'antlr4'我准确地说,antlr4已经存在于我的计算机中:
$ antlr4
ANTLR Parser Generator Version 4.5.1
-o ___ specify output directory where all output is generated
-lib ___ specify location of grammars, tokens files
...我也尝试了两个小测试,test.py工作:
#!/usr/bin/python3
import os, re, sys
print('test')但这个版本并没有:
#!/usr/bin/python3
import os, re, sys
import antlr4
print('test')请问如何将这个antlr4模块与python连接起来?提前感谢
发布于 2018-04-17 09:29:50
嗯,this page上的帮助似乎没问题。
一揽子计划的内容:
与pip3安装的包不同。
我已经将./python3.5/antlr4 4的内容替换为我下载并手动提取的包中的内容:
~/Downloads/antlr4-python3-runtime-4.7/src/antlr4
希望它能帮助其他人:)
https://stackoverflow.com/questions/49873969
复制相似问题