"来自sklearn.preprocessing导入LabelEncoder,OneHotEncoder"更新Anaconda中的软件包后失败

时间:2018-01-02 15:05:38

标签: python scikit-learn anaconda

最近我更新了anaconda的软件包,以便安装keras和tensorflow。现在我的程序在下一行失败了:

from sklearn.preprocessing import LabelEncoder, OneHotEncoder.

Traceback (most recent call last):

  File "<ipython-input-1-83540d56f55d>", line 1, in <module>
    from sklearn.preprocessing import LabelEncoder, OneHotEncoder

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/sklearn/__init__.py", line 134, in <module>
    from .base import clone

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/sklearn/base.py", line 13, in <module>
    from .utils.fixes import signature

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/sklearn/utils/__init__.py", line 11, in <module>
    from .validation import (as_float_array,

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/sklearn/utils/validation.py", line 18, in <module>
    from ..utils.fixes import signature

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/sklearn/utils/fixes.py", line 144, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/scipy/sparse/linalg/__init__.py", line 114, in <module>
    from .isolve import *

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/scipy/sparse/linalg/isolve/__init__.py", line 6, in <module>
    from .iterative import *

  File "/Users/teologov/anaconda/lib/python3.6/site-packages/scipy/sparse/linalg/isolve/iterative.py", line 7, in <module>
    from . import _iterative

ImportError: dlopen(/Users/teologov/anaconda/lib/python3.6/site-packages/scipy/sparse/linalg/isolve/_iterative.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libgfortran.3.dylib
  Referenced from: /Users/teologov/anaconda/lib/python3.6/site-packages/scipy/sparse/linalg/isolve/_iterative.cpython-36m-darwin.so
  Reason: image not found
你可以帮我解决一下。

2 个答案:

答案 0 :(得分:0)

从头开始重新安装解决了这个问题,已安装的软件包中存在一些版本冲突。

答案 1 :(得分:0)

在我的情况下,我升级scikit学习包。 然后转到anaconda navigator环境,然后搜索scikit learn

然后升级它并同时升级scipy(相同的过程)