File "D:\Anaconda\envs\tensorflow\lib\site-packages\pyglet\canvas\base.py", line 65, in get_screen

https://blog.csdn.net/XJY104165/article/details/78806343?utm_source=blogxgwz8
试图运行强化学习代码时报错:
runfile(‘F:/tensorflow_code/temp.py’, wdir=‘F:/tensorflow_code’)
Traceback (most recent call last):

File “”, line 1, in
runfile(‘F:/tensorflow_code/temp.py’, wdir=‘F:/tensorflow_code’)

File “D:\Anaconda\envs\tensorflow\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 678, in runfile
execfile(filename, namespace)

File “D:\Anaconda\envs\tensorflow\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 106, in execfile
exec(compile(f.read(), filename, ‘exec’), namespace)

File “F:/tensorflow_code/temp.py”, line 12, in
env.render()

File “D:\Anaconda\envs\tensorflow\lib\site-packages\gym\core.py”, line 275, in render
return self.env.render(mode, **kwargs)

File “D:\Anaconda\envs\tensorflow\lib\site-packages\gym\envs\classic_control\cartpole.py”, line 151, in render
self.viewer = rendering.Viewer(screen_width, screen_height)

File “D:\Anaconda\envs\tensorflow\lib\site-packages\gym\envs\classic_control\rendering.py”, line 51, in init
self.window = pyglet.window.Window(width=width, height=height, display=display)

File “D:\Anaconda\envs\tensorflow\lib\site-packages\pyglet\window_init_.py”, line 504, in init
screen = display.get_default_screen()

File “D:\Anaconda\envs\tensorflow\lib\site-packages\pyglet\canvas\base.py”, line 73, in get_default_screen
return self.get_screens()[0]

File “D:\Anaconda\envs\tensorflow\lib\site-packages\pyglet\canvas\base.py”, line 65, in get_screens
raise NotImplementedError(‘abstract’)

NotImplementedError: abstract

解决方案
你必须将pyglet 1.3降级到pyglet 1.2.4。 只需在你的anaconda prompt提示符下键入: pip install pyglet==1.2.4 。 之后,重新启动你的Spyder ide。

你可能感兴趣的:(强化学习)