bert模型训练时sklearn.__check_build._check_build问题

bert模型训练sklearn.__check_build._check_build报错
报错:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\test_4_6\lib\site-packages\sklearn\__check_build\__init__.py", line 44, in <module>
    from ._check_build import check_build  # noqa
ModuleNotFoundError: No module named 'sklearn.__check_build._check_build'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/data/代码/代码/Bert文本分类/run.py", line 8, in <module>
    from train_eval import train, init_network
  File "D:\data\代码\代码\Bert文本分类\train_eval.py", line 6, in <module>
    from sklearn import metrics
  File "C:\ProgramData\Anaconda3\envs\test_4_6\lib\site-packages\sklearn\__init__.py", line 81, in <module>
    from . import __check_build  # noqa: F401
  File "C:\ProgramData\Anaconda3\envs\test_4_6\lib\site-packages\sklearn\__check_build\__init__.py", line 46, in <module>
    raise_build_error(e)
  File "C:\ProgramData\Anaconda3\envs\test_4_6\lib\site-packages\sklearn\__check_build\__init__.py", line 31, in raise_build_error
    raise ImportError("""%s
ImportError: No module named 'sklearn.__check_build._check_build'
___________________________________________________________________________
Contents of C:\ProgramData\Anaconda3\envs\test_4_6\lib\site-packages\sklearn\__check_build:
setup.py                  _check_build.cp36-win_amd64.pyd__init__.py
__pycache__
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

Process finished with exit code 1

重新下载安装过相关的库但是还是无法解决
相关库版本:

```python

scikit-learn --0.24.2
scipy --1.5.4
numpy --1.20.1
sklearn --0.0
python --3.8.8

```

试试以下命令

pip uninstall sklearn
pip install numpy scipy
pip install scikit-learn

该回答通过自己思路及引用到GPTᴼᴾᴱᴺᴬᴵ搜索,得到内容具体如下:
这个错误提示显示 scikit-learn 没有正确地构建。这种情况通常是由于安装 scikit-learn 的版本与当前 Python 版本或操作系统不兼容导致的。

尝试重新安装 scikit-learn 的最新版本,或者检查您的 Python 版本和操作系统是否与 scikit-learn 版本兼容。您还可以尝试使用以下命令重新安装 scikit-learn:

pip uninstall scikit-learn
pip install -U scikit-learn

如果重新安装 scikit-learn 仍然无法解决问题,您可以考虑使用其他版本的 scikit-learn 或者尝试使用其他机器学习库来代替 scikit-learn 完成您的任务。


如果以上回答对您有所帮助,点击一下采纳该答案~谢谢

以下内容部分参考ChatGPT模型:
该错误提示是由于sklearn包没有正确构建或安装而导致的。您可以尝试以下解决方案:

  1. 确保您已正确安装sklearn包并且版本与您的Python环境兼容。建议使用pip安装sklearn包:

    pip install -U scikit-learn

  2. 如果您已经正确安装sklearn包,尝试重新安装它:

    pip uninstall scikit-learn

    pip install -U scikit-learn

  3. 如果您使用的是anaconda环境,可以尝试在命令行中执行以下命令:

    conda install scikit-learn

  4. 如果以上解决方案均未能解决问题,您可以尝试从源代码中构建sklearn包:

    ```
    git clone https://github.com/scikit-learn/scikit-learn.gi