I would like to use ANTLR4 with Python 2.7 and for this I did the following:
I installed the package
antlr4-4.6-1
on Arch Linux withsudo pacman -S antlr4
.I wrote a
MyGrammar.g4
file and successfully generated Lexer and Parser Code withantlr4 -Dlanguage=Python2 MyGrammar.g4
Now executing for example the generated Lexer code with
python2 MyGrammarLexer.py
results in the errorImportError: No module named antlr4
.
What could to be the problem? FYI: I have both Python2 and Python3 installed - I don't know if that might cause any trouble.
Requirement already satisfied: antlr4-python2-runtime in /usr/lib/python3.6/site-packages
. It might be the case that pip does not work correctly for the two python versions but I don't know how to figure out the problem... – Drone