0

I'm trying to import antlr4 into a python3 code but I obtain the error:

$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    import antlr4
ImportError: No module named 'antlr4'

I precise that antlr4 is already present in my computer:

$ antlr4
ANTLR Parser Generator  Version 4.5.1
 -o ___              specify output directory where all output is generated
 -lib ___            specify location of grammars, tokens files
...

I tryed with 2 little tests too, test.py works:

#!/usr/bin/python3
import os, re, sys
print('test')

but this version doesn't:

#!/usr/bin/python3
import os, re, sys
import antlr4
print('test')

How can I connect this antlr4 module with python, please? Thanks in advance

Pim92
  • 99
  • 1
  • 5
  • 15

1 Answers1

1

Well, it seems it is ok with help on this page.

That content of the package:

https://pypi.python.org/packages/0b/6b/30c5b84d203b62e1412d14622e3bae6273399d79d20f3a24c8145213f610/antlr4-python3-runtime-4.7.tar.gz#md5=190245a0fb4abf43568489a4b6e33aba

is different from the package installed by pip3.

I have replaced content of: .../python3.5/antlr4 with content from the package I have downloaded and extracted manually:

~/Downloads/antlr4-python3-runtime-4.7/src/antlr4

Hope it could help others :)

Pim92
  • 99
  • 1
  • 5
  • 15