【问题标题】:ImportError: Cannot import name check_build from partially initialize module 'sklearn'ImportError:无法从部分初始化模块“sklearn”导入名称 check_build
【发布时间】:2020-07-21 05:00:04
【问题描述】:

我在尝试从 sklearn 导入时遇到以下错误

from pandas import read_csv
from numpy import mean
from matplotlib import pyplot
from sklearn.metrics import mean_squared_error

这是错误:

ImportError                               Traceback (most recent call last)
<ipython-input-1-c57768f466c0> in <module>
      2 from numpy import mean
      3 from matplotlib import pyplot
----> 4 from sklearn.metrics import mean_squared_error

~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sklearn\__init__.py in <module>
     79     # it and importing it first would fail if the OpenMP dll cannot be found.
     80     from . import _distributor_init  # noqa: F401
---> 81     from . import __check_build  # noqa: F401
     82     from .base import clone
     83     from .utils._show_versions import show_versions

ImportError: cannot import name '__check_build' from partially initialized module 'sklearn' (most likely due to a circular import) (C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sklearn\__init__.py)

【问题讨论】:

标签: python scikit-learn scipy


【解决方案1】:

我有同样的问题,但我设法解决了......你的时间尝试: 请按照顺序进行操作。 在cmd,

    • a)pip uninstall numpy

    • b)pip卸载scipy

    • c) pip 卸载 matplotlib

    • d)pip uninstall sklearn

    • e) pip 卸载 scikit-learn

那么,

    • a) pip install numpy
    • b)pip安装scipy
    • c)pip安装matplotlib
    • D)PIP安装Sklearn Li>
    • e)pip安装scikit-rearing

遵循1a)至1e),然后2a)至2e)。

【讨论】:

    猜你喜欢
    • 2013-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-27
    • 2023-04-08
    相关资源
    最近更新 更多