配置Atari Gym环境

1.首先安装gym:

pip install gym[accept-rom-license]

https://github.com/openai/gym/releases/tag/v0.21.0https://github.com/openai/gym/releases/tag/v0.21.0

2.安装ALE

pip install ale-py

3.安装AUTOROM、导入ROMs

pip install autorom[accept-rom-license]
AutoROM

到这里应该就没有问题了,运行以下代码查看是否安装成功:

import gym
env = gym.make('Breakout-v0')
obs = env.reset()
print(obs.shape)  # (210, 160, 3)

如果还有问题,尝试一下

pip install -U gym

stackoverflowhttps://stackoverflow.com/questions/69371528/attributeerror-module-ale-py-gym-has-no-attribute-algymenv

或者使用老版本方法安装:

老方法https://blog.csdn.net/weixin_39986534/article/details/118015964

pip install gym

pip install atari-py
导入atari的 ROMs 包
下载 url:http://www.atarimania.com/rom_collection_archive_atari_2600_roms.html
先下载到download目录

python3 -m atari_py.import_roms ./
 

再或者

1.安装指定版本的gym和altari-py

pip install gym==0.19.0
pip install atari_py==0.2.6

 2.安装rom
官方参考:

https://github.com/openai/atari-py#roms

中文参考:

Exception: ROM is missing for ms_pacman, see https://github.com/openai/atari-py#roms for instruction_CSU_FuChou的博客-CSDN博客

参考:https://blog.csdn.net/dannnnnnnnnnnn/article/details/122776301?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.pc_relevant_default&utm_relevant_index=5https://blog.csdn.net/dannnnnnnnnnnn/article/details/122776301?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~default-2.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~default-2.pc_relevant_default&utm_relevant_index=5

你可能感兴趣的:(强化学习,pytorch)