我正在尝试运行 OpenAI Gym 环境,但出现以下错误:
import gym
env = gym.make('Breakout-v0')
错误
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ale_py/gym/environment.py:11: DeprecationWarning: Importing atari-py roms won't be supported in future releases of ale-py.
import ale_py.roms as roms
A.L.E: Arcade Learning Environment (version +a54a328)
[Powered by Stella]
Traceback (most recent call last):
File "/Users/username/Desktop/OpenAI Gym Stuff/OpenAI_Exp.py", line 2, in <module>
env = gym.make('Breakout-v0')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gym/envs/registration.py", line 200, in make
return registry.make(id, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gym/envs/registration.py", line 105, in make
env = spec.make(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gym/envs/registration.py", line 75, in make
env = cls(**_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ale_py/gym/environment.py", line 123, in __init__
self.seed()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ale_py/gym/environment.py", line 171, in seed
raise error.Error(
gym.error.Error: Unable to find game "Breakout", did you import Breakout with ale-import-roms?
原文由 gapansi99 发布,翻译遵循 CC BY-SA 4.0 许可协议
代码适用于
gym
0.18.0
和0.19.0
但不适用于0.20.0
你可以降级它
顺便说一句:它可能还需要安装
gym[atari]
或gym[all]
才能使所有元素正常工作。根据 0.21.0 发行说明中的 信息(尚未准备好
pip
但您可以从 GitHub 安装)ALE
(Arcade Learning Environment
) 它造成了所有问题,但它已在0.21.0
中修复。但是新的
gym[atari]
不安装 ROM,你需要使用模块 AutoROM编辑:
GitHub 的版本
0.21.0
安装后对我有用(它可能需要程序
git
)AutoRom 运行的程序会询问您是否拥有 ROM 的许可证并在
AutoROM/roms
中安装 ROM,但我不必将 ROM 移动到其他地方。安装后,这段代码对我有用,没有错误,也没有
DeprecationWarning
。它给了