【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

检查是否还有该提示



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

相关推荐
chase。1 分钟前
Python包构建工具完全指南:python -m build 使用详解
开发语言·chrome·python
xin_yao_xin6 分钟前
PaddleOCR系列——《文本检测、文本识别》模型训练
人工智能·python·paddlepaddle·ppocr
2401_833197736 分钟前
用Python制作一个文字冒险游戏
jvm·数据库·python
万粉变现经纪人23 分钟前
如何解决 pip install cx_Oracle 报错 未找到 Oracle Instant Client 问题
数据库·python·mysql·oracle·pycharm·bug·pip
sw12138924 分钟前
使用Plotly创建交互式图表
jvm·数据库·python
2301_8101609526 分钟前
如何为开源Python项目做贡献?
jvm·数据库·python
若惜27 分钟前
selenium自动化测试web自动化测试 框架封装Pom
前端·python·selenium
weixin_4577600033 分钟前
基于pytorch实现LPR模型车牌识别
人工智能·pytorch·python·深度学习·lpr
Zaly.35 分钟前
【Python刷题】LeetCode 3567 子矩阵的最小绝对差
python·leetcode·矩阵
2501_9454235441 分钟前
使用PyTorch构建你的第一个神经网络
jvm·数据库·python