ModuleNotFoundError: No module named 'sklearn.cross_validation'
本文为CSDN博主「不服输的南瓜」的原创文章,遵循 CC 4.0 BY-SA 版权协议
ModuleNotFoundError: No module named 'sklearn.cross_validation'
from sklearn.cross_validation import KFold from sklearn.cross_validation import train_test_split
sklearn更新后在执行以上代码时可能会出现这样的问题:
ModuleNotFoundError: No module named 'sklearn.cross_validation'
如下图所示:
ModuleNotFoundError: No module named 'sklearn.cross_validation'
此时可以考虑使用以下方法导入库:
from sklearn.model_selection import KFold from sklearn.model_selection import train_test_split
此时就不会报错了。