OpenGL错误 [Python [OpenGL] [OpenAI Gym]
我在使用OpenAI的ChatGPT和DALL-E之后,现在在用gym,结果我的代码出现了一个错误,这个错误一直在重复出现(顺便说一下,我的电脑是Intel HD 3000,它提示我在OpenGL中有一些东西不存在)。所以我的代码和错误信息是这样的:
代码(main.py):
import gym
import matplotlib.pyplot as plt
env = gym.make('MountainCar-v0')
# Observation and action space
obs_space = env.observation_space
action_space = env.action_space
print("The observation space: {}".format(obs_space))
print("The action space: {}".format(action_space))
# reset the environment and see the initial observation
obs = env.reset()
print("The initial observation is {}".format(obs))
# Sample a random action from the entire action space
random_action = env.action_space.sample()
# # Take the action and get the new observation space
new_obs, reward, done, info = env.step(random_action)
print("The new observation is {}".format(new_obs))
env.render(mode = "human")
错误信息:
Warning: Parameters to load are deprecated. Call .resolve and .require separately.
result = entry_point.load(False)
The observation space: Box(2,)
The action space: Discrete(3)
The initial observation is [-0.53907843 0. ]
The new observation is [-0.53996238 -0.00088394]
Traceback (most recent call last):
File "c:\Users\Acer\Desktop\game-bot\main.py", line 23, in <module>
env.render(mode = "human")
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\core.py", line 174, in render
return self._render(mode=mode, close=close)
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\core.py", line 341, in _render
return self.env.render(mode, close)
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\core.py", line 174, in render
return self._render(mode=mode, close=close)
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\envs\classic_control\mountain_car.py", line 79, in _render
self.viewer = rendering.Viewer(screen_width, screen_height)
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\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 "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\window\win32\__init__.py", line 104,
in __init__
super(Win32Window, self).__init__(*args, **kwargs)
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\window\__init__.py", line 582, in __init__
self._create_projection()
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\window\__init__.py", line 590, in _create_projection
shader.Shader(self._default_vertex_source, 'vertex'),
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\graphics\shader.py", line 794, in __init__
shader_id = glCreateShader(shader_type)
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\gl\lib_wgl.py", line 66, in __call__
return self.func(*args, **kwargs)
File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\gl\lib.py", line 25, in MissingFunction
raise MissingFunctionException(name, requires, suggestions)
pyglet.gl.lib.MissingFunctionException: glCreateShader is not exported by the available OpenGL driver. OpenGL 2.0 is required for this functionality.
我尝试更新OpenGL,但错误还是没解决。我几乎查看了所有的解决方案,但还是遇到同样的错误。
0 个回答
暂无回答