淘先锋技术网

首页 1 2 3 4 5 6 7

初次使用scipy就遇到这个问题,我第一感觉就是这应该是版本问题,有的博主说通过修改scipy的版本即;

# 首先卸载掉现有版本的scipy
pip uninstall scipy

# 然后安装指定版本
pip install scipy==1.2.1

这个方法我试过,还是安装失败;

然后重新看一下报错的信息;

Traceback (most recent call last):
  File "main.py", line 9, in <module>
    from gensim.models import Word2Vec
  File "D:\python3.7.7\lib\site-packages\gensim\__init__.py", line 6, in <module>
    from gensim import parsing, matutils, interfaces, corpora, models, similarities, summarization
  File "D:\python3.7.7\lib\site-packages\gensim\models\__init__.py", line 7, in <module>
    from .coherencemodel import CoherenceModel
  File "D:\python3.7.7\lib\site-packages\gensim\models\coherencemodel.py", line 29, in <module>
    from gensim.models.ldamodel import LdaModel
  File "D:\python3.7.7\lib\site-packages\gensim\models\ldamodel.py", line 56, in <module>
    from scipy.misc import logsumexp
ImportError: cannot import name 'logsumexp' from 'scipy.misc' (D:\python3.7.7\lib\site-packages\scipy\misc\__init__.py)

 可以看到是ldamodel.py中的56行出现问题,应该版本更新;

将程序中的:

from scipy.misc import logsumexp

改成:

from scipy.special import logsumexp

然后重新运行就大功告成!!!