我正在尝试在Jupyter Notebook上导入sklearn,但它给了我一个错误AttributeError: module 'scipy' has no attribute '__version__'
。
错误的完整描述如下:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-72-b7c74cbf5af0> in <module>
----> 1 import sklearn
~/opt/anaconda3/lib/python3.7/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.7/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.7/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.7/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.7/site-packages/sklearn/utils/validation.py in <module>
23 from contextlib import suppress
24
---> 25 from .fixes import _object_dtype_isnan, parse_version
26 from .. import get_config as _get_config
27 from ..exceptions import NonBLASDotWarning, PositiveSpectrumWarning
~/opt/anaconda3/lib/python3.7/site-packages/sklearn/utils/fixes.py in <module>
30
31 np_version = parse_version(np.__version__)
---> 32 sp_version = parse_version(scipy.__version__)
33
34
AttributeError: module 'scipy' has no attribute '__version__'
我尝试pip uninstall scipy
并重新安装它,但是它没有用,仍然无法解决问题。这里有没有人知道如何修复或遇到它?