- PyTorch 1.x Reinforcement Learning Cookbook
- Yuxi (Hayden) Liu
- 104字
- 2021-06-24 12:34:39
There's more...
You may wonder why we need to install Atari dependencies. In fact, there are a few more environments that do not accompany the installation of gym, such as Box2d, Classic control, MuJoCo, and Robotics.
Take the Box2d environments, for example; we need to install the Box2d dependencies before we first run the environments. Again, two installation approaches are as follows:
pip install gym[box2d]
pip install -e '.[box2d]'
After that, we can play around with the LunarLander environment, as follows:
>>> env = gym.make('LunarLander-v2')
>>> env.reset()
array([-5.0468446e-04, 1.4135642e+00, -5.1140346e-02, 1.1751971e-01,
5.9164839e-04, 1.1584054e-02, 0.0000000e+00, 0.0000000e+00],
dtype=float32)
>>> env.render()
A game window will pop up:
