我已经尝试卸载并重新安装 sklearn、scipy、numpy、anaconda3 并没有解决这个问题。提供下面的代码和错误消息
代码 :
from sklearn import svm,datasets
错误摘要
ImportError: dlopen(/opt/anaconda3/lib/python3.8/site-packages/scipy/spatial/qhull.cpython-38-darwin.so, 2): bad rebase type 0 in /opt/anaconda3/lib/python3.8/site-packages/scipy/spatial/../.dylibs/libopenblas.0.dylib
所有错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-f79259517934> in <module>
1 # Import libraries and packages
2 # import sklearn
----> 3 from sklearn import svm,datasets
4 import pickle
5 import numpy as np
/opt/anaconda3/lib/python3.8/site-packages/sklearn/__init__.py in <module>
78 from . import _distributor_init # noqa: F401
79 from . import __check_build # noqa: F401
---> 80 from .base import clone
81 from .utils._show_versions import show_versions
82
/opt/anaconda3/lib/python3.8/site-packages/sklearn/base.py in <module>
19 from . import __version__
20 from ._config import get_config
---> 21 from .utils import _IS_32BIT
22 from .utils.validation import check_X_y
23 from .utils.validation import check_array
/opt/anaconda3/lib/python3.8/site-packages/sklearn/utils/__init__.py in <module>
21
22 from .murmurhash import murmurhash3_32
---> 23 from .class_weight import compute_class_weight, compute_sample_weight
24 from . import _joblib
25 from ..exceptions import DataConversionWarning
/opt/anaconda3/lib/python3.8/site-packages/sklearn/utils/class_weight.py in <module>
5 import numpy as np
6
----> 7 from .validation import _deprecate_positional_args
8
9
/opt/anaconda3/lib/python3.8/site-packages/sklearn/utils/validation.py in <module>
24 from contextlib import suppress
25
---> 26 from .fixes import _object_dtype_isnan
27 from .. import get_config as _get_config
28 from ..exceptions import NonBLASDotWarning, PositiveSpectrumWarning
/opt/anaconda3/lib/python3.8/site-packages/sklearn/utils/fixes.py in <module>
16 import scipy.sparse as sp
17 import scipy
---> 18 import scipy.stats
19 from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
20 from numpy.ma import MaskedArray as _MaskedArray # TODO: remove in 0.25
/opt/anaconda3/lib/python3.8/site-packages/scipy/stats/__init__.py in <module>
439 ""
440
--> 441 from .stats import *
442 from .distributions import *
443 from .morestats import *
/opt/anaconda3/lib/python3.8/site-packages/scipy/stats/stats.py in <module>
35 from numpy import array, asarray, ma
36
---> 37 from scipy.spatial.distance import cdist
38 from scipy.ndimage import measurements
39 from scipy._lib._util import (check_random_state, MapWrapper,
/opt/anaconda3/lib/python3.8/site-packages/scipy/spatial/__init__.py in <module>
96 from .kdtree import *
97 from .ckdtree import *
---> 98 from .qhull import *
99 from ._spherical_voronoi import SphericalVoronoi
100 from ._plotutils import *
ImportError: dlopen(/opt/anaconda3/lib/python3.8/site-packages/scipy/spatial/qhull.cpython-38-darwin.so, 2): bad rebase type 0 in /opt/anaconda3/lib/python3.8/site-packages/scipy/spatial/../.dylibs/libopenblas.0.dylib