python-Levenshtein AttributeError: module 'Levenshtein' has no attribute 'distance'
python-Levenshtein AttributeError: module 'Levenshtein' has no attribute 'distance'
今天咋运行程序的时候,出现了下面的错误:
[1/1000][15050/15056] Loss = 85.33192443847656[1/1000][15051/15056] Loss = 85.493408203125[1/1000][15052/15056] Loss = 78.12874603271484[1/1000][15053/15056] Loss = 86.8485107421875[1/1000][15054/15056] Loss = 81.8629150390625[1/1000][15055/15056] Loss = 136.6531219482422decoding0it [00:01, ?it/s]Traceback (most recent call last): File "train.py", line 117, in
然后发现自己已经装了Levenshtein。
解决方法
pip install python-Levenshtein==0.11.2
我原来的版本是0.12,降了一下版本,然后就不报错了。
测试代码为:
import Levenshtein as levlev.distance('Levenshtein', 'Lenvinsten')
如果正常输出为4的话,说明是正常的。
参考文献
[1].How to import and use python Levenshtein extension on OSX?. https://stackoverflow.com/questions/28172261/how-to-import-and-use-python-levenshtein-extension-on-osx
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~