python强化学习时可能会遇到环境模拟的异常
env = gym.envs.make("Breakout-v0")
Exception Traceback (most recent call last)
<ipython-input-3-7584539d0f0c> in <module>
----> 1 env = gym.envs.make("Breakout-v0")
~/miniconda3/envs/lwhao-rl/lib/python3.9/site-packages/gym/envs/registration.py in make(id, **kwargs)
143
144 def make(id, **kwargs):
--> 145 return registry.make(id, **kwargs)
146
147 def spec(id):
~/miniconda3/envs/lwhao-rl/lib/python3.9/site-packages/gym/envs/registration.py in make(self, path, **kwargs)
88 logger.info('Making new env: %s', path)
89 spec = self.spec(path)
---> 90 env = spec.make(**kwargs)
91 # We used to have people override _reset/_step rather than
92 # reset/step. Set _gym_disable_underscore_compat = True on
~/miniconda3/envs/lwhao-rl/lib/python3.9/site-packages/gym/envs/registration.py in make(self, **kwargs)
58 else:
59 cls = load(self.entry_point)
---> 60 env = cls(**_kwargs)
61
62 # Make the environment aware of which spec it came from.
~/miniconda3/envs/lwhao-rl/lib/python3.9/site-packages/gym/envs/atari/atari_env.py in __init__(self, game, mode, difficulty, obs_type, frameskip, repeat_action_probability, full_action_space)
47
48 self.game = game
---> 49 self.game_path = atari_py.get_game_path(game)
50 self.game_mode = mode
51 self.game_difficulty = difficulty
~/miniconda3/envs/lwhao-rl/lib/python3.9/site-packages/atari_py/games.py in get_game_path(game_name)
18 path = os.path.join(_games_dir, game_name) + ".bin"
19 if not os.path.exists(path):
---> 20 raise Exception('ROM is missing for %s, see https://github.com/openai/atari-py#roms for instructions' % (game_name,))
21 return path
22
通过以下地址,下载Roms.rar
http://www.atarimania.com/rom_collection_archive_atari_2600_roms.html
将Roms.rar解压缩以后,运行命令,即可解决。
python -m atari_py.import_roms <path to folder>