You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows10下Python3.10.6安装ppscore失败:scikit-learn编译报错求助

解决ppscore安装失败(依赖scikit-learn 0.24.2编译报错)的方案

问题概述

64位Windows10、Python3.10.6环境下,执行pip install -U ppscore时安装失败:

  • ppscore依赖限制为scikit-learn<1.0.0,>=0.20.2,pip自动尝试安装0.24.2版本
  • 编译scikit-learn 0.24.2时触发文件创建错误,核心报错:
    error: could not create 'build\bdist.win-amd64\wheel\.\sklearn\datasets\tests\data\openml\292\api-v1-json-data-list-data_name-australian-limit-2-data_version-1-status-deactivated.json.gz': No such file or directory
    
  • 现有环境已安装scikit-learn 1.1.1,无法满足ppscore旧版本的依赖要求

根本原因

  1. scikit-learn 0.24.2发布于Python3.10正式版之前,官方未提供适配Python3.10的预编译wheel,pip只能从源码编译,而源码编译过程中存在测试文件路径或资源缺失问题。
  2. ppscore旧版本(如1.2.0)的依赖约束未更新,不兼容scikit-learn 1.x系列版本。

可行解决方案

方案1:安装适配Python3.10的scikit-learn 0.24.2预编译wheel

避免源码编译,直接使用第三方提供的预编译wheel:

  1. 获取对应Python3.10、64位的scikit-learn 0.24.2 wheel文件(文件名格式为scikit_learn-0.24.2-cp310-cp310-win_amd64.whl)
  2. 下载到本地后执行本地安装:
    pip install 本地文件路径\scikit_learn-0.24.2-cp310-cp310-win_amd64.whl
    
  3. 完成后执行pip install ppscore即可正常安装。

方案2:跳过依赖检查安装ppscore,适配现有scikit-learn 1.1.1

直接安装ppscore并跳过旧版本依赖限制,验证兼容性:

  1. 执行命令跳过依赖检查安装:
    pip install ppscore --no-deps
    
  2. 若运行时出现API兼容问题,升级ppscore到最新版本(最新版已适配scikit-learn 1.x):
    pip install --upgrade ppscore
    

方案3:创建虚拟环境隔离依赖

不影响现有环境,新建虚拟环境安装ppscore所需旧版本依赖:

  1. 创建并激活虚拟环境:
    python -m venv pps_env
    pps_env\Scripts\activate
    
  2. 安装适配的scikit-learn和ppscore:
    pip install scikit-learn==0.24.2 --only-binary :all:
    pip install ppscore
    
    (--only-binary :all:参数强制pip使用预编译wheel,若找不到则需改用方案1的本地wheel安装)

验证安装

执行以下代码确认ppscore正常运行:

import ppscore as pps
import pandas as pd

df = pd.DataFrame({
    "x": [1,2,3,4,5],
    "y": [2,4,5,4,5],
    "z": [3,5,4,5,4]
})
print(pps.predictors(df, "y"))

内容的提问来源于stack exchange,提问作者JubG

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 09:01:00