【发布时间】:2021-02-08 06:41:04
【问题描述】:
我正在使用来自健身房的 CartPole-v0 的 RL colab。我通过连接到远程 centOS 7.3 服务器(不是谷歌驱动器)的 jupyter 打开了 iPython 笔记本。以下代码在 google colab 下正确呈现了购物车图,但在我的 jupyter 设置中却没有:
!pip install gym[classic_control]
import gym
env = gym.make('CartPole-v0')
env.reset()
img = env.render('rgb_array')
plt.imshow(img)
以下是我启动 jupyter notebook 的方式:
xvfb-run -a -s "-screen 0 1400x900x24" jupyter notebook
显然,渲染的图像具有未初始化的尺寸或 0 尺寸。无论是否使用 Jupyter,这都是正确的。
我在pyglet/image/__init__.py 中的错误之前打印了一行
def get_image_data(self):
# xxx = GLubyte * (len(self.format) * self.width * self.height)
print(GLubyte, len(self.format), self.width, self.height) # my code
buffer = (GLubyte * (len(self.format) * self.width * self.height))()
结果要么是(4 0 0) 要么是(4 1551512832 274094153),据我推断宽度和高度未初始化。但是我对内部的了解还不够深入,无法进一步调试。在前一种情况下,MemoryError 变成了无法渲染大小为零的图像的错误。
感谢任何见解。以下是一些相关主题:
【问题讨论】:
标签: jupyter-notebook openai-gym