AttributeError: 'TimeLimit' object has no attribute 'monitor'

时间:2021-02-14 22:51:50
原报错代码部分:
env.monitor.start(monitor_path,
resume=True,
video_callable=lambda count: count % record_video_every == 0)

reason:
env.monitor is deprecated. Wrap your env with gym.wrappers.Monitor to record data.

所以改为 env = Monitor()
注意:1.加from gym.wrappers import monitor
2.Monitor()内部参数要改为Monitor(env, directory=monitor_path,其他直接写)