无法加载gridworld-v0环境

时间:2019-10-06 10:24:12

标签: python openai-gym

我正在尝试在gridworld环境上执行强化学习算法,但是我找不到加载它的方法。

我已经成功安装了Gym和gridworld 0.14.0,然后执行了此命令

env = gym.make("gridworld-v0")

然后我获得了以下错误堆栈

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in spec(self, path)
    131         try:
--> 132             return self.env_specs[id]
    133         except KeyError:

KeyError: 'gridworld-v0'

During handling of the above exception, another exception occurred:

UnregisteredEnv                           Traceback (most recent call last)
<ipython-input-36-b3991c5b334f> in <module>
----> 1 env = gym.make("gridworld-v0")
      2 env.setPlan("gridworldPlans/plan1.txt", {0: -0.001, 3: 1, 4: 1, 5: -1, 6: -1})
      3 statedic, mdp = env.getMDP()

~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in make(id, **kwargs)
    154 
    155 def make(id, **kwargs):
--> 156     return registry.make(id, **kwargs)
    157 
    158 def spec(id):

~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in make(self, path, **kwargs)
     98         else:
     99             logger.info('Making new env: %s', path)
--> 100         spec = self.spec(path)
    101         env = spec.make(**kwargs)
    102         # We used to have people override _reset/_step rather than

~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in spec(self, path)
    140                 raise error.DeprecatedEnv('Env {} not found (valid versions include {})'.format(id, matching_envs))
    141             else:
--> 142                 raise error.UnregisteredEnv('No registered env with id: {}'.format(id))
    143 
    144     def register(self, id, **kwargs):

UnregisteredEnv: No registered env with id: gridworld-v0

我希望它足以加载环境,但显然足够了。

您能建议我如何进行吗?

干杯, 保罗

1 个答案:

答案 0 :(得分:0)

应该大写:

ActiveRecord::RecordNotFound (Couldn't find TodoList with 'id'=5 [WHERE "todo_lists"."event_id" = ?]):

更多参考:https://pypi.org/project/gym-gridworlds/