如何在 macOS 上从源码构建 manimgl
Manim 是一个精确的程序化动画引擎,用于创建解释性数学视频。
Download source code
Section titled “Download source code”cd ~/projectsgit clone https://github.com/3b1b/manim.gitcd manimconda create -n manim-build-from-source python=3.10conda activate manim-build-from-sourcemapbox-earcut
Section titled “mapbox-earcut”pip install mapbox-earcutffmpeg
Section titled “ffmpeg”brew install ffmpegmactex
Section titled “mactex”brew install mactex验证 mactex 安装
Section titled “验证 mactex 安装”Type latex --version in the terminal.
latex --version
# OutputpdfTeX 3.141592653-2.6-1.40.26 (TeX Live 2024)kpathsea version 6.4.0Copyright 2024 Han The Thanh (pdfTeX) et al.There is NO warranty. Redistribution of this software iscovered by the terms of both the pdfTeX copyright andthe Lesser GNU General Public License.For more information about these matters, see the filenamed COPYING and the pdfTeX source.Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.Compiled with libpng 1.6.43; using libpng 1.6.43Compiled with zlib 1.3.1; using zlib 1.3.1Compiled with xpdf version 4.04如果输出如上所示,那么恭喜你,mactex 已成功安装。你可以继续 下一步。
否则,请继续。我们需要修复这个问题。 我不确定为什么,但有时,当 brew install mactex 完成后,它只是下载一个包到你的磁盘。你仍然需要手动安装它。
brew info mactex
# Output❯ brew info mactex==> mactex: 2024.0312https://www.tug.org/mactex/Installed/opt/homebrew/Caskroom/mactex/2024.0312 (5.6GB)From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/m/mactex.rb==> NameMacTeX==> DescriptionFull TeX Live distribution with GUI applications==> Dependenciesghostscript==> Artifactsmactex-20240312.pkg (Pkg)==> CaveatsYou must restart your terminal window for the installation of MacTeX CLItools to take effect.
Alternatively, Bash and Zsh users can run the command:
eval "$(/usr/libexec/path_helper)"
==> Analyticsinstall: 3,166 (30 days), 7,794 (90 days), 30,329 (365 days)复制高亮的路径并在终端中打开它。
open /opt/homebrew/Caskroom/mactex/2024.031你会看到一个名为 mactex-<date>.pkg 的文件
tree /opt/homebrew/Caskroom/mactex/2024.0312/opt/homebrew/Caskroom/mactex/2024.0312└── mactex-20240312.pkg
1 directory, 1 file打开这个文件并手动安装。
安装完成后,重新 验证 mactex 安装,现在 mactex 应该可以正常工作。
pip install -e ./manim验证 manimgl 安装
Section titled “验证 manimgl 安装”which manimgl # output: /opt/anaconda3/envs/manim-build-from-source/bin/manimgl使用 manimgl
Section titled “使用 manimgl”cd ~/projects/manimmanimgl example_scenes.py TexTransformExample你应该能够看到下面的动画。
恭喜你,你已经完成了所有步骤。
如果遇到安装和使用问题,可以在 这里 创建一个 Issue。
查看 示例场景 以查看库的语法、动画类型和对象类型示例。
在 3b1b/videos 仓库中,你可以看到所有 3blue1brown 视频的代码。