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

使用pip安装bnlearn库时出现subprocess-exited-with-error错误求助

解决pip install bnlearn时的sklearn弃用报错

报错信息

Collecting bnlearnNote: you may need to restart the kernel to use updated packages.
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      The 'sklearn' PyPI package is deprecated, use 'scikit-learn'
      rather than 'sklearn' for pip commands.
      
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
...
│ exit code: 1
╰─> See above for output.

问题原因

sklearn PyPI包已被官方弃用,官方明确要求使用scikit-learn作为包名执行pip命令。bnlearn的构建依赖中仍引用了旧的sklearn包名,导致构建wheel时失败。

解决方案

方法1:先安装官方包再安装bnlearn

  1. 手动安装官方支持的scikit-learn包:
pip install scikit-learn
  1. 重新执行bnlearn安装命令:
pip install bnlearn

方法2:强制替换依赖包名

如果方法1无效,可直接在安装bnlearn时指定替换弃用的包:

pip install bnlearn --replace-packages sklearn=scikit-learn

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 01:52:09