【问题标题】:How to install manimgl on Google Colab?如何在 Google Colab 上安装 manimgl?
【发布时间】:2021-06-09 10:20:00
【问题描述】:
我想在 Google Colab 上使用 manimgl,但简单的 !pip install manimgl 似乎不起作用。我看了几个解决方案。特别是:
你有解决办法吗?
【问题讨论】:
标签:
google-colaboratory
manim
【解决方案1】:
我找到了一种相对简单的方法。实际上有一个名为jupyter-manim 的库,只要稍加调整就可以很好地工作。这是我所做的:
!apt-get install -qq pkg-config libcairo2-dev
!pip3 install jupyter-manim --quiet
!sudo apt-get -qq update
!sudo apt-get install -qq texlive-full
-qq 根本就是不获取提示输出。
仅供参考,整个安装过程有点长(大约 5 分钟)。
那么,你应该可以运行了:
import jupyter_manim
from manimlib.imports import *
import statistics
%%manim OpeningScene --base64
class OpeningScene(Scene):
def construct(self):
first_line = TextMobject("Data Structures and Algorithms")
second_line = TextMobject("Time Complexity and Big O Notation")
self.play(Write(first_line))
self.wait(2)
self.play(Transform(first_line, second_line))
self.wait(3)
self.play(FadeOut(first_line))
我的灵感来自这个笔记本:https://colab.research.google.com/drive/1KDPi9Im-dfknrUokBpSwEM6Z710JF6Wc?usp=sharing#scrollTo=9BpcNKiWZeu-