【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

检查是否还有该提示



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

相关推荐
叶子丶苏2 小时前
第十八节_PySide6基本窗口控件深度补充_剪贴板与拖曳功能(QMimeData 类) 上篇
python·pyqt
酷酷的佳2 小时前
python--面向对象(3)
python
百锦再2 小时前
Python实现开源AI模型引入及测试全过程
人工智能·python·ai·开源·aigc·模型·自然语言
Mr.Lee jack2 小时前
【torch.compile】PyTorch Dynamo 和 Inductor 编译流程
人工智能·pytorch·深度学习
有时有晌2 小时前
影视解说混剪工具
python·影视解说·影视混剪
BoBoZz192 小时前
ImplicitPolyDataDistance 隐式距离显示
python·vtk·图形渲染·图形处理
小张帅三代2 小时前
华为昇腾服务器ubuntu Anaconda安装PyTorch npu 版本 步骤
服务器·pytorch·ubuntu
m5655bj2 小时前
如何通过 Python 在 Excel 中添加或删除图片
python·excel
qq_356196952 小时前
day42Dataset和Dataloader@浙大疏锦行
python