openai 健身房 env.P,AttributeError 'TimeLimit' 对象没有属性 'P' [英] openai gym env.P, AttributeError 'TimeLimit' object has no attribute 'P'

查看:91
本文介绍了openai 健身房 env.P,AttributeError 'TimeLimit' 对象没有属性 'P'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在阅读 Sudharsan Ravichandiran 的 Hands-On Reinforcement Learning with Python 以及我遇到这个 AttributeError 的第一个例子:

I'm currently reading Hands-On Reinforcement Learning with Python by Sudharsan Ravichandiran and on one of the first examples I run into this AttributeError:

AttributeError 'TimeLimit' 对象没有属性 'P'

由以下行引发:

for next_sr in env.P[state][action]: 

我找不到关于 env.P 的任何文档,但我在这里找到了一个用 python2 编写的类似示例:https://gym.openai.com/evaluations/eval_48sirBRSRAapMjotYzjb6w/

I can't find any documentation regarding env.P, but I found a similar example written in python2 here: https://gym.openai.com/evaluations/eval_48sirBRSRAapMjotYzjb6w/

我想 env.P 是一个过时的图书馆的一部分(即使这本书是 2018 年 6 月出版的并且被指控的代码在 python3 中),那么我该如何替换它?>

I suppose env.P is part of an outdated library (even if the the book was published on June 2018 and the incriminated code is in python3), so how can i replace it?

推荐答案

首先尝试通过添加这个来解开 env

Try to unwrap the env first by adding this

env = env.unwrapped

这篇关于openai 健身房 env.P,AttributeError 'TimeLimit' 对象没有属性 'P'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆