ModuleNotFoundError: No module named 'numpy.random.bit_generator'

ModuleNotFoundError: No module named 'numpy.random.bit_generator'

我想在我的项目中使用 sklearn.metrics 中的 classification_report 模块。但是,我收到此错误消息,我不确定如何解决。

from sklearn.metrics import classification_report
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\__init__.py", line 82, in <module>
    from .base import clone
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\utils\__init__.py", line 28, in <module>
    from .fixes import np_version, parse_version
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\sklearn\utils\fixes.py", line 20, in <module>
    import scipy.stats
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\__init__.py", line 441, in <module>
    from .stats import *
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\stats.py", line 43, in <module>
    from . import distributions
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\distributions.py", line 11, in <module>
    from . import _discrete_distns
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\scipy\stats\_discrete_distns.py", line 19, in <module>      
    from .biasedurn import (_PyFishersNCHypergeometric,
  File "biasedurn.pyx", line 1, in init scipy.stats.biasedurn
ModuleNotFoundError: No module named 'numpy.random.bit_generator'
pip3 install scipy==1.7.1 numpy==1.18.5 scikit-learn==0.24.2 --no-cache-dir --no-binary :all:

试一试,不知道行不行:D

运行下面一行,强制重新安装numpy包。由于软件包以某种方式损坏,因此已修复。

conda install numpy --force-reinstall