can't import nearest neighbors in scikit-learn 0.16

允我心安 提交于 2021-02-08 08:38:16

问题


Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import sklearn
sklearn.__version__
'0.16.1'
from sklearn.neighbors import NearestNeighbors

Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/neighbors/__init__.py", line 9, in <module>
    from .graph import kneighbors_graph, radius_neighbors_graph   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/neighbors/graph.py", line 9, in <module>
    from .base import KNeighborsMixin, RadiusNeighborsMixin   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/neighbors/base.py", line 18, in <module>
    from ..metrics import pairwise_distances   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/metrics/__init__.py", line 15, in <module>
    from .classification import accuracy_score   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/metrics/classification.py", line 31, in <module>
    from ..preprocessing import LabelBinarizer, label_binarize   File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/preprocessing/__init__.py", line 25, in <module>
    from ._weights import balance_weights ImportError: cannot import name 'balance_weights'

来源:https://stackoverflow.com/questions/30124375/cant-import-nearest-neighbors-in-scikit-learn-0-16

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!