ModuleNotFoundError: No module named ‘sklearn.datasets‘; ‘sklearn‘ is not a package

Traceback (most recent call last):
  File "E:/Python/PycharmProjects/机器学习/学习/sklearn.py", line 4, in
    from sklearn.datasets import load_boston
  File "E:\Python\PycharmProjects\机器学习\学习\sklearn.py", line 4, in
    from sklearn.datasets import load_boston
ModuleNotFoundError: No module named 'sklearn.datasets'; 'sklearn' is not a package

报这个错误:

1、确认自己是否安装sklearn库,输入

pip list

查看已安装列表里有没有scikit-learn,如果没有输入以下命令安装sklearn库。

pip install sklearn

2、如果已有sklearn库,查看自己的文件名是否是sklearn。

你可能感兴趣的:(sklearn,python,人工智能)