ImportError:无法导入名称“ mean_absolute_difference”
尝试再次卸载并安装。
import gensim
ImportError Traceback (most recent call last)
<ipython-input-28-e70e92d32c6e> in <module>()
----> 1 import gensim
2 frames
/usr/local/lib/python3.6/dist-packages/gensim/models/hdpmodel.py in
<module>()
61
62 from gensim import interfaces, utils, matutils
---> 63 from gensim.matutils import dirichlet_expectation,
mean_absolute_difference
64 from gensim.models import basemodel, ldamodel
65
ImportError: cannot import name 'mean_absolute_difference'
答案 0 :(得分:0)
我尝试使用gensim
在Linux上安装!pip install gensim
,然后像您一样导入后,效果很好。如下图所示。
>>> !pip install gensim
>>> import gensim
>>> from gensim import interfaces, utils, matutils
>>> from gensim.matutils import dirichlet_expectation, mean_absolute_difference
>>>