ソースコードのエラーがわかりません。教えてください。
python
1import gym 2env = gym.make('CartPole-v0') 3env.reset() 4for _ in range(1000): 5 env.render() 6 env.step(env.action_space.sample()) # take a random action 7env.close()
error
1NoSuchDisplayException Traceback (most recent call last) 2<ipython-input-1-ae18def96b83> in <module>() 3 3 env.reset() 4 4 for _ in range(1000): 5----> 5 env.render() 6 6 env.step(env.action_space.sample()) # take a random action 7 7 env.close() 8 99 frames 10/usr/local/lib/python3.6/dist-packages/pyglet/canvas/xlib.py in __init__(self, name, x_screen) 11 121 self._display = xlib.XOpenDisplay(name) 12 122 if not self._display: 13--> 123 raise NoSuchDisplayException('Cannot connect to "%s"' % name) 14 124 15 125 screen_count = xlib.XScreenCount(self._display) 16 17NoSuchDisplayException: Cannot connect to "None" 18