我正在尝试使用 ALE 来测试 Atari 游戏与体育馆。我正在使用下面的代码来创建 Breakout 环境。
import gymnasium as gym
env = gym.make('ALE/Breakout-v5')
done = False
while not done:
_, _, done, _ = env.step(env.action_space.sample())
env.render()
env.close()
当我运行此代码时,它返回以下错误:
Error: We're Unable to find the game "Breakout". Note: Gymnasium no longer distributes ROMs. If you own a license to use the necessary ROMs for research purposes you can download them via `pip install gymnasium[accept-rom-license]`. Otherwise, you should try importing "Breakout" via the command `ale-import-roms`. If you believe this is a mistake perhaps your copy of "Breakout" is unsupported. To check if this is the case try providing the environment variable `PYTHONWARNINGS=default::ImportWarning:ale_py.roms`. For more information see: https://github.com/mgbellemare/Arcade-Learning-Environment#rom-management
我的体育馆版本是:0.29.1 我的 ALE 版本是:0.8.1
我已按照体育馆文档中的步骤进行操作,但出现了此问题。有人有什么想法吗?
pip install gymnasium
-> Successfully installed farama-notifications-0.0.4 gymnasium-0.29.1
pip install gymnasium[atari]
-> Successfully installed ale-py-0.8.1 shimmy-0.2.1
pip install gymnasium[accept-rom-license]
-> Successfully installed AutoROM.accept-rom-license-0.6.1 autorom-0.4.2
之前安装最后一行时,重现了您的错误消息:pip install gymnasium[accept-rom-license]
。确保...
gymnasium
,而不是
gym
。
import gymnasium as gym; print(f'Gymnasium v{gym.__version__}')
env = gym.make('ALE/Breakout-v5', render_mode='rgb_array')
env.metadata['render_fps'] = 60
env.reset()
done = False
while not done:
_, _, done, _, _ = env.step(env.action_space.sample())
env.render()
env.close()
输出
>> Gymnasium v0.29.1