【Anaconda | Python | pytorch】sklearn scikit-learn 报错:

文章目录

question

Import "sklearn.model_selection" could not be resolved from source

Analysis && Solution

This is a code completion/Intelligent suggestion error in an IDE (such as VS Code), not a runtime error. It indicates a problem with Pylance (VS Code's...).

The Python extension could not find the source code for the sklearn.model_selection module, therefore it cannot provide features such as auto-completion and jump to definitions.

could not be resolved from source

Possible reasons:

  • The scikit-learn package is not installed correctly/not installed.
  • Perform a check using pip list | findstr scikit-learn@[TOC]

问题

Import "sklearn.model_selection" could not be resolved from source

分析&&解决

这是一个 IDE(如 VS Code)中的代码提示/智能感知错误,而不是程序运行时的错误。它表示 Pylance(VS Code 的

Python 扩展)无法找到 sklearn.model_selection 模块的源码位置,所以不能提供自动补全、跳转定义等功能。'

could not be resolved from source

可能的原因:

  • 没有正确/没有安装该包 scikit-learn 没有安装
    • 做检查 pip list | findstr scikit-learn ;conda list scikit-learn
  • Python 环境配置错误 ,是不是你选错环境了。/选错了 错误的解释器(Python 解释器)(conda)
安装 conda install scikit-learn



重启vscode

检查是否还有该提示



要是还存在就不是没有安装的问题了

相关推荐
明日清晨12 分钟前
python扫码登录dy
开发语言·python
bazhange26 分钟前
python如何像matlab一样使用向量化替代for循环
开发语言·python·matlab
人工干智能39 分钟前
科普:python中你写的模块找不到了——`ModuleNotFoundError`
服务器·python
unicrom_深圳市由你创科技1 小时前
做虚拟示波器这种实时波形显示的上位机,用什么语言?
c++·python·c#
小敬爱吃饭1 小时前
Ragflow Docker部署及问题解决方案(界面为Welcome to nginx,ragflow上传文件失败,Docker中的ragflow-cpu-1一直重启)
人工智能·python·nginx·docker·语言模型·容器·数据挖掘
宸津-代码粉碎机1 小时前
Spring Boot 4.0虚拟线程实战调优技巧,最大化发挥并发优势
java·人工智能·spring boot·后端·python
知行合一。。。1 小时前
Python--04--数据容器(集合)
python
Captain_Data1 小时前
Python机器学习sklearn线性模型完整指南:LinearRegression/Ridge/Lasso详细代码注释
python·机器学习·数据分析·线性回归·sklearn
爱码小白1 小时前
MySQL 单表查询练习题汇总
数据库·python·算法
北辰alk2 小时前
全网最详实!Python 全家桶框架深度对比:从 Web 开发到 AI 应用,一篇打通选型关
python