我尝试在 python Gymnasium 中加载并运行用于强化学习的 atari 游戏。 每当调用 env.step(action) 函数时,它都会产生以下错误
我的代码是
game_name = 'VideoPinball-v0'
env = wrap_env(gym.make(game_name,
render_mode="rgb_array"))
env.reset()
print("Observation Space: ", env.observation_space)
print("Action Space ", env.action_space)
for _ in range(1000):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
if terminated:
observation, info = env.reset()
env.close()
结果:
TypeError: game_over(): 函数参数不兼容。支持以下参数类型:
- (self: ale_py._ale_py.ALEInterface) -> bool
调用:
; kwargs: with_truncation=False
但是我不清楚根本问题是什么。
我使用的是 ale-py 0.75,它与 gymnasium==0.27.1 一起导致错误。 升级到 0.80 解决了这个问题。
有人对此有解决方案吗?
我有同样的错误: TypeError: game_over(): 不兼容的函数参数。支持以下参数类型: 1. (self: ale_py._ale_py.ALEInterface) -> bool
调用:
上面的解决方案不起作用