我要导入
from sklearn.tree import DecisionTreeRegressor
在朱皮特。
但是当我只运行包含上述导入的行时,出现此错误。
<ipython-input-16-28b3e81cd98d> in <module>
----> 1 from sklearn.tree import DecisionTreeRegressor
~/.local/lib/python3.6/site-packages/sklearn/tree/__init__.py in <module>
4 """
5
----> 6 from ._classes import BaseDecisionTree
7 from ._classes import DecisionTreeClassifier
8 from ._classes import DecisionTreeRegressor
~/.local/lib/python3.6/site-packages/sklearn/tree/_classes.py in <module>
38 from ..utils.validation import check_is_fitted
39
---> 40 from ._criterion import Criterion
41 from ._splitter import Splitter
42 from ._tree import DepthFirstTreeBuilder
~/.local/lib/python3.6/site-packages/sklearn/tree/_criterion.cpython-36m-x86_64-linux-gnu.so in init sklearn.tree._criterion()
AttributeError: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__'
我尝试安装 scipy 并通过 conda 更新 scikit-learn 但没有解决。
最佳答案
尝试更新 Cython:
pip install cython
关于python - 属性错误: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59293402/