ImportError: cannot import name 'cross_validation' from 'sklearn'
程序员文章站
2022-07-14 11:40:52
...
使用sklearn(scikit-learn) import cross_validation的时候报错如下:
ImportError: cannot import name 'cross_validation' from 'sklearn'
原来的代码为:
from sklearn import cross_validation as cv
原因:
sklearn.cross_validation是sklearn老版本中的模块
新版本都迁移到了sklearn.model_selection
解决办法将
cross_validation 换为 model_selection
from sklearn import model_selection as cv
问题解决。
上一篇: unity编辑器
推荐阅读
-
pycharm读取图片,提示ImportError: cannot import name imread解决方法
-
ImportError: cannot import name 'cross_validation' from 'sklearn'
-
cannot import name 'Flask' from 'flask'
-
ImportError: cannot import name 'Optional'
-
Python中使用Enum类时出现cannot import name ‘Enum‘ from partially initialized module ‘enum‘
-
cannot import name ‘Graph‘ from ‘pyecharts‘
-
解决pyecharts importerror问题:cannot import name ‘bar’ from pyecharts
-
ImportError: cannot import name ‘Bar‘ from ‘pyecharts‘ (D:\Anaconda3-2019.03\Anaconda3\lib\site-pack
-
2021-06-13cannot import name ‘Bar‘ from ‘pyecharts.charts‘ (C:\Users\SieburgShen\AppData\Roaming\Pyt
-
ImportError: cannot import name 'connections' from 'haystack'