【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

检查是否还有该提示



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

相关推荐
少云清7 分钟前
【接口测试】3_Dubbo接口 _Telnet或python远程调用Dubbo接口
开发语言·python·dubbo·接口测试
纪伊路上盛名在9 分钟前
如何为我们的GPU设备选择合适的CUDA版本和Torch版本?
pytorch·深度学习·torch·cuda·英伟达
小途软件12 分钟前
ssm327校园二手交易平台的设计与实现+vue
java·人工智能·pytorch·python·深度学习·语言模型
Hooray111 小时前
前后端分离_案例学习_Python+Flask+VUE3
后端·python·学习·flask
小二·2 小时前
Python 学习教程(第2篇):用 Flask 开发你的第一个 Web 应用
python·学习·flask
落叶,听雪2 小时前
河南AI建站
人工智能·python
数据大魔方2 小时前
【期货量化入门】期权交易入门:从零开始学期权量化(TqSdk完整教程)
数据库·python·mysql·算法·区块链·程序员创富
@zulnger3 小时前
python 学习笔记(文件和目录操作)
笔记·python·学习
zuozewei3 小时前
零基础 | 基于LangChain的角色扮演聊天机器人实现
python·langchain·机器人
Dxy12393102163 小时前
Python如何使用DrissionPage做自动化:简单入门指南
开发语言·python·自动化