首页 > 解决方案 > 从 github 安装 OpenAI Gym 环境

问题描述

有人可以逐步向我解释如何从 github 安装健身房环境吗?我尝试了一些事情,但我不明白他们在做什么,他们没有工作。经验:

py -3 -m pip install git+https://github.com/grantsrb/Gym-Snake
py -3 -m pip install -e .[dev]

这些是有问题的环境:

https://github.com/grantsrb/Gym-Snake

https://github.com/nicomon24/Sneks

当我运行以下代码时:

import gym
env=gym.make('snake-v0')

这是显示的错误消息:

Traceback (most recent call last):
  File "C:\Users\Aj\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gym\envs\registration.py", line 118, in spec
    return self.env_specs[id]
KeyError: 'snake-v0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python27\snaketry.py", line 21, in <module>
    env=gym.make('snake-v0')
  File "C:\Users\Aj\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gym\envs\registration.py", line 142, in make
    return registry.make(id, **kwargs)
  File "C:\Users\Aj\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gym\envs\registration.py", line 86, in make
    spec = self.spec(path)
  File "C:\Users\Aj\AppData\Local\Programs\Python\Python38-32\lib\site-packages\gym\envs\registration.py", line 128, in spec
    raise error.UnregisteredEnv('No registered env with id: {}'.format(id))
gym.error.UnregisteredEnv: No registered env with id: snake-v0

标签: pythonpython-3.xopenai-gym

解决方案


推荐阅读