【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

检查是否还有该提示



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

相关推荐
imgsq13 分钟前
电子学会考级 vs CCF-GESP:两套少儿编程考级怎么选
python·青少年编程
Smoothcloud润云37 分钟前
PyTorch推理服务动态批处理实战:兼顾吞吐与延迟
人工智能·pytorch·python·深度学习·ai·gpu算力
码爸1 小时前
决策树介绍与示例
python·算法·机器学习
临床数据科学和人工智能兴趣组1 小时前
正则表达式的基础语法的基本符号
开发语言·人工智能·python·正则表达式·r语言·r语言-4.2.1·workbudyy
王中阳Go1 小时前
Go 后端转 AI:非科班怎么补?一张 3 列路线表(可保存)
开发语言·人工智能·后端·python·golang·大语言模型
计算机编程指导师2 小时前
【计算机毕设选题推荐】基于Hadoop的宫颈癌变进程光谱数据分析系统源码 毕业设计 选题推荐 毕设选题 数据分析 机器学习
大数据·hadoop·python·数据分析·spark·毕业设计·宫颈癌变
夜雪一千2 小时前
应用层加密的优缺点
python
计算机编程指导师2 小时前
【计算机毕设选题推荐】基于Hadoop+Spark的化妆品销售大数据分析系统源码 毕业设计 选题推荐 毕设选题 数据分析 机器学习
大数据·hadoop·python·spark·毕业设计·课程设计·化妆品
用户0332126663673 小时前
Python 实用技巧:从零自主生成结构化 PDF 页面
python
benchmark_cc3 小时前
前复权数据每天可能变化,历史数据库应该覆盖还是保留原始价格?
大数据·python·pandas·量化交易·股票数据·quantdash