How to run OpenAI Gym .render() over a server

前端 未结 15 2186
囚心锁ツ
囚心锁ツ 2020-12-12 10:07

I am running a python 2.7 script on a p2.xlarge AWS server through Jupyter (Ubuntu 14.04). I would like to be able to render my simulations.

Minimal working example<

15条回答
  •  一向
    一向 (楼主)
    2020-12-12 10:40

    I avoided the issues with using matplotlib by simply using PIL, Python Image Library:

    import gym, PIL
    env = gym.make('SpaceInvaders-v0')
    array = env.reset()
    PIL.Image.fromarray(env.render(mode='rgb_array'))
    

    I found that I didn't need to set the XV frame buffer.

提交回复
热议问题