google-colaboratory - 从介绍页面运行演示的 OpenAI Gym 错误
问题描述
我安装了 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 库吗?
谢谢。
解决方案
Google Colab 在云中运行。它无法将图形显示发送回您的显示器。
您可以尝试使用本地运行时运行它。 https://research.google.com/colaboratory/local-runtimes.html
推荐阅读
- selenium - TestNG Assert 失败时如何截屏?
- python - 从 Odoo 14 中的数据库中检索数据
- amazon-web-services - 属于 IAM 组的 AWS IAM 用户不能代入允许 IAM 组代入的 IAM 角色?
- quickbooks-online - 如何使用 qbxml 为退回的物品发出 quickbooks 现金退款
- c# - Assets\camswitch.cs(7,22): error CS1519: Invalid token ';' 在类、结构或接口成员声明中
- sql - 需要在 MS SQL 服务器中为以下数据生成以下格式年的输出,q1,q2,q3,q4
- python - Python对于HTML上选中的每个复选框列获取列值
- java - 使用 Retrofit 从 API Post 调用获取错误请求
- mongodb - 有没有办法比较 MongoDB 查询中的两个字段
- selenium - 无法在 Mac OS SUR 中使用 python 启动 selenium