cannot import name 'cross_validation' from 'sklearn' (C:\Users\86183\miniconda3\lib\site-packages\sklearn\__init__.py)
时间: 2023-09-10 19:07:22 浏览: 228
这个错误是由于无法从'sklearn'中导入'cross_validation'引起的。在最新版本的sklearn库中,'cross_validation'已经被重命名为'model_selection'。因此,您需要在代码中将'cross_validation'替换为'model_selection'来解决这个问题。根据您提供的错误信息,可以看到在引用中出现的文件路径是"C:\Users\joesh\Desktop\Python\Machine Learning\1st tutorial.py"和"C:\Users\joesh\Desktop\Python\lib\site-packages\sklearn\__init__.py"。而在引用和引用中出现的文件路径分别为"C:\Users\myname\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py"。因此,您需要在这两个文件中进行相应的修改。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [问题解决:ImportError: cannot import name '_ccallback_c'](https://blog.csdn.net/maxMikexu/article/details/105464759)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Python Keras cross_val_score错误](https://blog.csdn.net/weixin_34790159/article/details/118902430)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文