pip install python-Levenshtein python import Levenshtein distance = Levenshtein.distance(str1, str2) ratio = Levenshtein.ratio(str1, str2)