I've downloaded the python-Levenshtein archive and extracted Levenshtein dir. So, in result I have the following files structure:
Levenshtein
- __init__.py
- _levenshtein.c
- _levenshtein.h
- StringMatcher.py
myscript.py
And the following myscript.py
content:
from Levenshtein import *
from warnings import warn
print Levenshtein.distance(string1, string2)
But I get the following error -
Traceback (most recent call last):
File "myscript.py", line 1, in <module>
from Levenshtein import *
File "/path/to/myscript/Levenshtein/__init__.py", line 1, in <module>
from Levenshtein import _levenshtein
ImportError: cannot import name _levenshtein
What is wrong here?
To install the python-Levenshtein package:
pip install python-levenshtein
(This requires pip, but most modern Python installations include it.)