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

Ubuntu 24.04环境下TensorFlow与TensorFlow Agents兼容版本及依赖配置求助

Ubuntu 24.04环境下TensorFlow与TensorFlow Agents兼容版本及依赖配置求助

我大概三年前在Ubuntu 18.04上用过TensorFlow Agents做强化学习项目,现在各种依赖包括Python版本都升级了,还带了不少破坏性更新,完全搞不定依赖配置了。

现在我要为一个强化学习项目自定义tf_environment,但连最基础的依赖都配不好。我根据谷歌搜索选了旧Python版本,我的pyproject.toml配置如下:

[project]
name = "rl-assignment"
version = "0.1.0"
description = "A project on reinforcement learning"
readme = "README.md"
requires-python = "==3.9.21"

对应的requirements.txt内容是:

polars==1.24.0
numpy==1.26.4
tensorflow==2.18.0
tf-agents==0.5.0 # Later versions face issue with pygame

我试着运行谷歌官方教程里的一段简单导入代码:

from tf_agents.environments import py_environment
from tf_agents.environments import tf_environment
from tf_agents.environments import tf_py_environment
from tf_agents.environments import utils
from tf_agents.specs import array_spec
from tf_agents.environments import wrappers
from tf_agents.environments import suite_gym
from tf_agents.trajectories import time_step as ts

结果直接抛出错误:

ModuleNotFoundError: No module named 'tensorflow.python.training.tracking'

这只是其中一个例子,我根据网上的帖子试过各种版本升级降级,但每次都会遇到新的错误,比如protobuf版本不兼容的问题也碰到过。

问题

能不能给我一个干净极简的requirements.txt(如果可以的话,Python版本越新越好),让TensorFlow和tf-agents能正常兼容工作?

备注:内容来源于stack exchange,提问作者Della

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.13 18:34:32