我安装了OpenAI Gym,并尝试运行入门推车极点演示(https://gym.openai.com/docs/)。 (我在Colab笔记本上跑步。)
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
这不会学习,但它应该显示推车和杆子。
当我运行它时,我收到警告和错误。
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
错误由env.render()
触发。 Traceback的底部是
Error occured while running `from pyglet.gl import *`
The original exception was:
ImportError: Library "GL" not found.
我已经安装了以下的pyOpenGL。
!pip install PyOpenGL PyOpenGL_accelerate
我非常感谢警告和错误的帮助。我应该安装另一个GL库吗?
感谢。
答案 0 :(得分:1)
Google Colab在云中运行。它无法将图形显示发送回显示器。
您可以尝试使用本地运行时运行它。 https://research.google.com/colaboratory/local-runtimes.html
答案 1 :(得分:0)