manim README

The project's README from github.com/3b1b/manim. As one markdown file: README.md.

pypi version MIT License Manim Subreddit Manim Discord docs

Manim is an engine for precise programmatic animations, designed for creating explanatory math videos.

Note, there are two versions of manim. This repository began as a personal project by the author of 3Blue1Brown for the purpose of animating those videos, with video-specific code available here. In 2020 a group of developers forked it into what is now the community edition, with a goal of being more stable, better tested, quicker to respond to community contributions, and all around friendlier to get started with. See this page for more details.

Installation

[!Warning] WARNING: These instructions are for ManimGL only. Trying to use these instructions to install Manim Community/manim or instructions there to install this version will cause problems. You should first decide which version you wish to install, then only follow the instructions for your desired version.

[!Note] Note: To install manim directly through pip, please pay attention to the name of the installed package. This repository is ManimGL of 3b1b. The package name is manimgl instead of manim or manimlib. Please use pip install manimgl to install the version in this repository.

Manim runs on Python 3.10 or higher.

System requirements are FFmpeg, OpenGL and LaTeX (optional, if you want to use LaTeX). For Linux, Pango along with its development headers are required. See instruction here.

Directly

# Install manimgl
pip install manimgl

# Try it out
manimgl

For more options, take a look at the Using manim sections further below.

If you want to hack on manimlib itself, clone this repository and in that directory execute:

# Install manimgl
pip install -e .

# Try it out
manimgl example_scenes.py OpeningManimExample
# or
manim-render example_scenes.py OpeningManimExample

Linux (Ubuntu/Debian)

  1. Install system dependencies.
sudo apt update

sudo apt install ffmpeg
sudo apt install python3-pip
sudo apt install libpango1.0-dev
  1. Install a lightweight LaTeX distribution (optional, for LaTeX rendering).
sudo apt install texlive-science texlive-fonts-extra texlive-latex-extra

This lightweight setup is significantly smaller than installing texlive-full while still supporting most Manim projects.

  1. Clone and install ManimGL.
git clone https://github.com/3b1b/manim.git
cd manim

python3 -m pip install -e .

manimgl example_scenes.py OpeningManimExample
💡 Optional: Using a virtual environment (venv)

It is recommended to use a virtual environment to avoid conflicts with system packages.

sudo apt install python3-venv

python3 -m venv venv
source venv/bin/activate

python3 -m pip install -e .

If python3-venv is unavailable on your system, try installing the version-specific package instead:

sudo apt install python3.12-venv

Directly (Windows)

  1. Install FFmpeg.
  2. Install a LaTeX distribution. MiKTeX is recommended.
  3. Install the remaining Python packages.
    git clone https://github.com/3b1b/manim.git
    cd manim
    pip install -e .
    manimgl example_scenes.py OpeningManimExample
    

Mac OSX

  1. Install FFmpeg, LaTeX in terminal using homebrew.

    brew install ffmpeg mactex
    
    💡 An alternative to heavyweight MacTeX bundle.

    To avoid installing the full MacTeX bundle, which is ~6GB, you can alternatively install the lightweight BasicTeX and then gradually add only the LaTeX packages you actually need. A list of packages sufficient to run examples can be found here. For an overview of the MacTeX installer bundles, see https://www.tug.org/mactex/.

  2. If you are using an ARM-based processor, install Cairo.

    arch -arm64 brew install pkg-config cairo
    
  3. Install latest version of manim using these command.

    git clone https://github.com/3b1b/manim.git
    cd manim
    pip install -e .
    manimgl example_scenes.py OpeningManimExample
    

    If the last command is not found, make sure the directory pip installed manimgl into is on your PATH.

Anaconda Install

  1. Install LaTeX as above.
  2. Create a conda environment using conda create -n manim python=3.10.
  3. Activate the environment using conda activate manim.
  4. Install manimgl using pip install -e ..

Using manim

Try running the following:

manimgl example_scenes.py OpeningManimExample

This should pop up a window playing a simple scene.

Look through the example scenes to see examples of the library's syntax, animation types and object types. In the 3b1b/videos repo, you can see all the code for 3blue1brown videos, though code from older videos may not be compatible with the most recent version of manim. The readme of that repo also outlines some details for how to set up a more interactive workflow, as shown in this manim demo video for example.

When running in the CLI, some useful flags include:

Take a look at custom_config.yml for further configuration. To add your customization, you can either edit this file, or add another file by the same name "custom_config.yml" to whatever directory you are running manim from. For example this is the one for 3blue1brown videos. There you can specify where videos should be output to, where manim should look for image files and sounds you want to read in, and other defaults regarding style and video quality.

Documentation

Documentation is in progress at 3b1b.github.io/manim. And there is also a Chinese version maintained by @manim-kindergarten: docs.manim.org.cn (in Chinese).

manim-kindergarten wrote and collected some useful extra classes and some codes of videos in manim_sandbox repo.

Contributing

Is always welcome. As mentioned above, the community edition has the most active ecosystem for contributions, with testing and continuous integration, but pull requests are welcome here too. Please explain the motivation for a given change and examples of its effect.

License

This project falls under the MIT license.

manim (3b1b/manim)

Searching Database…

95.2K ·GitHub
这是干什么的?ManimGL 是一个用代码精确生成动画的 Python 引擎,专为制作讲解数学概念的视频而设计——就是 3Blue1Brown 的作者用来做他自己视频的那个工具。
它是我写代码用的 Python 库,还是一个独立的软件?是一个以代码为主的库:你用 Python 代码写好场景然后运行,会弹出一个窗口播放这段动画;自带的示例场景本身就相当于一份语法和动画类型的入门导览。
pip install manim —— 用这条命令装它对吗?不对:这个仓库要用 pip install manimgl 来安装。单独的 manim 包是社区版,2020 年从这份代码分支出去的——把两个版本的安装说明混着用会出问题。
除了 Python,我的电脑上还需要装什么?FFmpeg 和 OpenGL 是必需的,LaTeX 是可选的,只有想渲染 LaTeX 公式时才需要;Linux 上还要装 Pango 及其开发头文件。Python 最低要求 3.10 或更高版本。
如果我从 3Blue1Brown 真实视频里拿代码来用,还能跑起来吗?视频的完整代码放在 3b1b/videos 仓库里,但较老视频的代码可能和最新版本的 manim 不兼容,所以老场景只能当作起点,需要自己改造。
它在 Windows 和 Mac 上能跑吗,还是只能在 Linux 上用?三个系统都支持——README 分别讲了 Ubuntu/Debian、Windows(需要 FFmpeg,LaTeX 用 MiKTeX)以及通过 Homebrew 在 macOS 上安装的方法;ARM 架构的 Mac 还需要额外装 Cairo。
怎么把动画导出成视频文件?用命令行参数控制输出:-w 把场景写入文件,-o 写入文件并打开结果,-s 直接跳到最后只显示最后一帧,-so 把那一帧保存成图片,-n 跳到第 n 个动画,-f 让播放窗口全屏。
有交互模式吗,还是只能渲染?有一种交互性更强的工作流程:3b1b/videos 仓库的 readme 介绍了怎么搭建,还有一个 manim 演示视频展示了实际效果。
我能控制视频保存到哪里、素材从哪里读取吗?可以——在你运行 manim 的目录里放一个 customconfig.yml(或直接修改现有的),就能设置视频的输出位置、manim 查找图片和声音文件的位置,以及样式和视频画质的默认值。
Creator
3b1b
Size
75.5 MB
Stars
95.2K
Age
11y
Commits · 90 Days