Getting started

If you don't have a full install of OpenAI gym, you can install the Atari environment dependencies via the following:

pip install gym[atari]

This requires the cmake tools. This command will automatically compile the arcade learning environment and its Python interface, atari-py. The compilation will take a few minutes on a common laptop, so go have a cup of coffee.

After the Atari environment is installed, try the following:

import gymatari = gym.make('Breakout-v0')atari.reset()atari.render()

If it runs successfully, a small window will pop up, showing the screen of the game Breakout, as shown in the following screenshot:

Get Python Reinforcement Learning Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.