Python-报错解决-ModuleNotFoundError No module named 'sklearn.cross_validation'

此文首发于我的个人博客:zhang0peter的个人博客


在使用anaconda写Python代码,运行

from sklearn.cross_validation import train_test_split

时报错:

ModuleNotFoundError: No module named ‘sklearn.cross_validation’

上网查阅资料后发现问题:

sklearn.cross_validation是sklearn老版本的模块,新版本都迁移到了

sklearn.model_selection

修改代码为

from sklearn.model_selection import train_test_split

即可正常运行