質問編集履歴
1
画像からコードにしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,59 @@
|
|
1
1
|
ソースコードのエラーがわかりません。教えてください。
|
2
2
|
|
3
|
+
```python
|
4
|
+
|
5
|
+
import gym
|
6
|
+
|
7
|
+
env = gym.make('CartPole-v0')
|
8
|
+
|
9
|
+
env.reset()
|
10
|
+
|
11
|
+
for _ in range(1000):
|
12
|
+
|
13
|
+
env.render()
|
14
|
+
|
15
|
+
env.step(env.action_space.sample()) # take a random action
|
16
|
+
|
17
|
+
env.close()
|
18
|
+
|
19
|
+
```
|
20
|
+
|
21
|
+
```error
|
22
|
+
|
23
|
+
NoSuchDisplayException Traceback (most recent call last)
|
24
|
+
|
25
|
+
<ipython-input-1-ae18def96b83> in <module>()
|
26
|
+
|
27
|
+
3 env.reset()
|
28
|
+
|
29
|
+
4 for _ in range(1000):
|
30
|
+
|
31
|
+
----> 5 env.render()
|
32
|
+
|
33
|
+
6 env.step(env.action_space.sample()) # take a random action
|
34
|
+
|
35
|
+
7 env.close()
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
9 frames
|
40
|
+
|
41
|
+
/usr/local/lib/python3.6/dist-packages/pyglet/canvas/xlib.py in __init__(self, name, x_screen)
|
42
|
+
|
3
|
-
|
43
|
+
121 self._display = xlib.XOpenDisplay(name)
|
44
|
+
|
45
|
+
122 if not self._display:
|
46
|
+
|
47
|
+
--> 123 raise NoSuchDisplayException('Cannot connect to "%s"' % name)
|
48
|
+
|
49
|
+
124
|
50
|
+
|
51
|
+
125 screen_count = xlib.XScreenCount(self._display)
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
NoSuchDisplayException: Cannot connect to "None"
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```
|