如何在Colab中设置Pyglet与Manim一起使用?

时间:2020-03-27 13:02:06

标签: python python-3.x google-colaboratory pyglet manim

我正在尝试在Colab中运行shaders version of Manim。此版本必须在实时交互式窗口中显示渲染的视频,而不是仅编写mp4。我安装并导入了所有内容,没有错误:

from manimlib.imports import *

但在运行时出现异常:

!python3 -m manim example_scenes.py OpeningManimExample

Media will be written to ./media/. You can change this behavior with the --media_dir flag.
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/content/manim/manim.py", line 5, in <module>
    manimlib.main()
  File "/content/manim/manimlib/__init__.py", line 11, in main
    scenes = manimlib.extract_scene.main(config)
  File "/content/manim/manimlib/extract_scene.py", line 104, in main
    scenes = get_scenes_to_render(all_scene_classes, config)
  File "/content/manim/manimlib/extract_scene.py", line 72, in get_scenes_to_render
    scene = scene_class(**scene_kwargs)
  File "/content/manim/manimlib/scene/scene.py", line 44, in __init__
    self.window = Window(self, **self.window_config)
  File "/content/manim/manimlib/window.py", line 21, in __init__
    super().__init__(**kwargs)
  File "/usr/local/lib/python3.6/dist-packages/moderngl_window/context/pyglet/window.py", line 54, in __init__
    config=config,
  File "/usr/local/lib/python3.6/dist-packages/pyglet/window/xlib/__init__.py", line 165, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pyglet/window/__init__.py", line 588, in __init__
    config = screen.get_best_config(config)
  File "/usr/local/lib/python3.6/dist-packages/pyglet/canvas/base.py", line 194, in get_best_config
    raise window.NoSuchConfigException()
pyglet.window.NoSuchConfigException

1 个答案:

答案 0 :(得分:0)

Colab在云上运行。

它不能使用pyglet在计算机上打开新窗口进行实时实时显示。

因此,着色器版本是不可能的。您可以成功运行mp4版本吗?