提问人:Matheus Brandão 提问时间:11/13/2023 最后编辑:Matheus Brandão 更新时间:11/13/2023 访问量:46
无法从“sklearn.exceptions”导入名称“InconsistentVersionWarning”
cannot import name 'InconsistentVersionWarning' from 'sklearn.exceptions'
问:
我正在尝试导入sklearn,但我不断收到此错误
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Users/matheusbrandaofreire/CEMIG/analises-watson-assistant/notebooks/0-65-ExperimentoWatsonAssistant.ipynb Célula 6 line 5
3 import numpy; print("NumPy", numpy.__version__)
4 import scipy; print("SciPy", scipy.__version__)
----> 5 import sklearn; print("Scikit-Learn", sklearn.__version__)
File ~/opt/miniconda3/lib/python3.9/site-packages/sklearn/__init__.py:83
69 # We are not importing the rest of scikit-learn during the build
70 # process, as it may not be compiled yet
71 else:
(...)
77 # later is linked to the OpenMP runtime to make it possible to introspect
78 # it and importing it first would fail if the OpenMP dll cannot be found.
79 from . import (
80 __check_build, # noqa: F401
81 _distributor_init, # noqa: F401
82 )
---> 83 from .base import clone
84 from .utils._show_versions import show_versions
86 __all__ = [
87 "calibration",
88 "cluster",
(...)
129 "show_versions",
130 ]
File ~/opt/miniconda3/lib/python3.9/site-packages/sklearn/base.py:18
16 from . import __version__
17 from ._config import config_context, get_config
---> 18 from .exceptions import InconsistentVersionWarning
19 from .utils import _IS_32BIT
20 from .utils._estimator_html_repr import estimator_html_repr
ImportError: cannot import name 'InconsistentVersionWarning' from 'sklearn.exceptions' (/Users/matheusbrandaofreire/opt/miniconda3/lib/python3.9/site-packages/sklearn/exceptions.py)
我也收到了numPy版本错误,但是我更改了他的版本,出现了这个新错误。
答: 暂无答案
评论
scikit-learn