问题描述
今天在运行自己创建的环境时,在执行以下代码时报错:
gym.envs.registration.register(
id='Fourrooms-v0',
entry_point='fourrooms:Fourrooms',
timestep_limit=20000,
reward_threshold=1,
)
错误描述:
File "/opt/conda/envs/moc/lib/python3.7/site-packages/gym/envs/registration.py", line 153, in register
return registry.register(id, **kwargs)
File "/opt/conda/envs/moc/lib/python3.7/site-packages/gym/envs/registration.py", line 147, in register
self.env_specs[id] = EnvSpec(id, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'timestep_limit'
解决方案
通过查阅:https://github.com/MattChanTK/gym-maze/issues/8
timestep_limit被重新命名成了max_episode_steps,因此,将代码中的timestep_limit修改为max_episode_steps即可。