【发布时间】:2025-12-26 13:20:20
【问题描述】:
每当我从 sklearn 导入任何 Tree 模块时都会遇到错误。下面的示例代码
from sklearn.ensemble import ExtraTreesRegressor
model = ExtraTreesRegressor()
model.fit(X,y)
我第一次运行代码时收到此错误 -
ImportError: cannot import name 'LatentDirichletAllocation' from 'sklearn.decomposition._online_lda' (C:\Users\lenovo\Anaconda3\lib\site-packages\sklearn\decomposition_online_lda.cp37-win_amd64.pyd)
之后,每当我运行相同的代码时,我都会收到以下错误 -
AttributeError: type object 'sklearn.tree.criterion.array' has no attribute 'reducecython'
同样的代码之前运行良好,但突然对我停止运行
我也尝试过卸载并重新安装 scikit-learn。任何帮助,将不胜感激。谢谢:)
【问题讨论】:
-
尝试从
conda-forge频道安装包:conda install scikit-learn -c conda-forge。
标签: python scikit-learn importerror