python-3.x - GlfwError: 无法创建 GLFW 窗口 (windows)
问题描述
我在windows 10 x64上使用 openAI gym,通过windows 远程桌面使用python 3.6.7 ,我成功安装了 atari-py和mujoco-py,但是当我尝试运行此代码时。
import gym
env = gym.make('Humanoid-v2')
for i_episode in range(100):
env.reset()
for t in range(100):
env.render()
action = env.action_space.sample()
observation, reward, done, info = env.step(action)
if done:
print("Episode finished after {} timesteps".format(t+1))
break
我收到了这个错误:
GLFW error (code %d): %s 65544 b'Vulkan: Failed to query instance extension count: The requested version of Vulkan is not supported by the driver or is otherwise incompatible'
Creating window glfw
GLFW error (code %d): %s 65542 b'WGL: The driver does not appear to support OpenGL'
Traceback (most recent call last):
File "test.py", line 7, in <module>
env.render()
File "D:\ReinforceLearning\RLenv\lib\site-packages\gym\core.py", line 275, in render
return self.env.render(mode, **kwargs)
File "D:\ReinforceLearning\RLenv\lib\site-packages\gym\envs\mujoco\mujoco_env.py", line 118, in render
self._get_viewer(mode).render()
File "D:\ReinforceLearning\RLenv\lib\site-packages\gym\envs\mujoco\mujoco_env.py", line 130, in _get_viewer
self.viewer = mujoco_py.MjViewer(self.sim)
File "D:\ReinforceLearning\RLenv\lib\site-packages\mujoco_py-1.50.1.0-py3.6.egg\mujoco_py\mjviewer.py", line 130, in __init__
super().__init__(sim)
File "D:\ReinforceLearning\RLenv\lib\site-packages\mujoco_py-1.50.1.0-py3.6.egg\mujoco_py\mjviewer.py", line 25, in __init__
super().__init__(sim)
File "RLenv\lib\site-packages\mujoco_py-1.50.1.0-py3.6.egg\mujoco_py\mjrendercontext.pyx", line 244, in mujoco_py.cymj.MjRenderContextWindow.__init__
super().__init__(sim, offscreen=False)
File "RLenv\lib\site-packages\mujoco_py-1.50.1.0-py3.6.egg\mujoco_py\mjrendercontext.pyx", line 43, in mujoco_py.cymj.MjRenderContext.__init__
self._setup_opengl_context(offscreen)
File "RLenv\lib\site-packages\mujoco_py-1.50.1.0-py3.6.egg\mujoco_py\mjrendercontext.pyx", line 92, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
self._opengl_context = GlfwContext(offscreen=offscreen)
File "RLenv\lib\site-packages\mujoco_py-1.50.1.0-py3.6.egg\mujoco_py\opengl_context.pyx", line 48, in mujoco_py.cymj.GlfwContext.__init__
self.window = self._create_window(offscreen)
File "RLenv\lib\site-packages\mujoco_py-1.50.1.0-py3.6.egg\mujoco_py\opengl_context.pyx", line 97, in mujoco_py.cymj.GlfwContext._create_window
raise GlfwError("Failed to create GLFW window")
mujoco_py.cymj.GlfwError: Failed to create GLFW window
解决方案
1.1 之后的 OpenGL 版本的 NVIDIA GPU 不支持 OpenGL over WindowsRemote。是否写过关于存在什么解决方法的文章: Windows Remote 上 OpenGL 的当前状态和解决方案
为伤口添加额外的盐:您可以启动 opengl 上下文,然后通过 WindowsRemote 连接。但是如果没有变通方法,直接在会话内启动是不可能的。
推荐阅读
- php - 读取图像文件导致错误 - 未捕获的 ReferenceError
- amazon-web-services - 为什么为跨区域 VPC 对等连接启用 DNS 解析支持
- python - 来自 pandas 数据框的图中的分组堆叠条形图
- qt - 如何让孩子在qml中跟随父母的旋转
- python - 如何在 Odoo 中返回两个变量?
- mysql - 使用多个索引时,MySql 查询很慢
- postgresql - 微服务似乎可以工作,但没有显示数据
- c++ - 降低两个 for 循环的时间复杂度并将其优化为 1 个 for 循环
- apache-spark - Spark 2.3.0 给出错误:Provider org.apache.spark.ml.source.libsvm.LibSVMFileFormat not a subtype
- ios - Firebase 观察者值影响所有集合视图单元格