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

安装Python版tensorflowjs时遇tensorflow_decision_forests错误求助

解决tensorflowjs安装时tensorflow_decision_forests依赖错误问题

问题场景

在Python中构建机器学习模型后,想要通过tensorflowjs将模型转换为Web可用格式,执行pip install tensorflowjs时出现以下错误:

ERROR: Could not find a version that satisfies the requirement tensorflow_decision_forests (from versions: none)
ERROR: No matching distribution found for tensorflow_decision_forests
Failure to load the inference.so custom c++ tensorflow ops. This error is likely caused the version of TensorFlow and TensorFlow Decision Forests are not compatible.

环境配置:

  • 使用conda创建Python 3.8/3.10虚拟环境
  • 已安装的TensorFlow相关库版本:
tensorboard == 2.13.0
tensorboard-data-server == 0.7.2
tensorflow == 2.13.0
tensorflow-estimator == 2.13.0
tensorflow-intel == 2.13.0 
tensorflow-io-gcs-filesystem == 0.31.0

已尝试操作:

  • 安装tensorflowjs多个版本(4.17、4.15、4.2.0及部分旧版本)
  • 调整TensorFlow库组合
  • 确认tensorflow_decision_forests仅支持Linux系统

解决方案

方法1:跳过tensorflow_decision_forests依赖安装

若你的模型未使用决策森林相关组件,可直接跳过该依赖安装tensorflowjs:

pip install tensorflowjs --no-deps

之后手动安装核心兼容依赖:

pip install numpy tensorflow six protobuf

方法2:安装与TensorFlow 2.13.0兼容的tensorflowjs版本

TensorFlow 2.13.0对应兼容的tensorflowjs版本为4.10.0,该版本不强制依赖tensorflow_decision_forests,直接执行:

pip install tensorflowjs==4.10.0

方法3:切换Linux环境(若模型依赖决策森林)

如果你的模型确实用到了TensorFlow Decision Forests功能,只能切换到Linux环境(如WSL2、Linux虚拟机或云服务器)进行安装和模型转换,因为该库目前仅支持Linux系统。


内容的提问来源于stack exchange,提问作者Sheikh Taha Maroof

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.01 00:47:16