# my_manim **Repository Path**: qCwCp/my_manim ## Basic Information - **Project Name**: my_manim - **Description**: Manim codes that used to create my videos. - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-08-16 - **Last Updated**: 2025-08-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: manim ## README # Manim (my_manim) 安装配置教程 ## Preface 本文介绍[本代码库](https://gitee.com/qCwCp/my_manim)的安装配置方法,由于本代码库是基于3b1b版本的[manimgl](https://github.com/3b1b/manim.git),故亦可用于该官方库 ## Step0. 其他依赖软件准备 包括: - FFmpeg - Latex (TexLive or MikTex, 笔者用了后者) 安装教程不做赘述 ## Step1. 安装python版本管理工具 建议使用python版本管理工具来准备manim使用的python环境 主要有conda / mamba等,安装参考: - python“全家桶”:[Anaconda安装教程](https://blog.csdn.net/Q_fairy/article/details/129158178) - 或参考视频[manim(ce)安装](https://www.bilibili.com/video/BV1om411k7Fv?spm_id_from=333.880.my_history.page.click)选择安装更轻量快速的mamba ## Step2. 准备python虚拟环境 ### (a) 使用conda 注意需要在Prompt (or cmd)中执行 (否则后面步骤会出现报错`Run 'conda init' before 'conda activate'`),打开窗口后,每条命令前都有`(base)`说明正确 安装python虚拟环境,manimgl支持3.7及以上的python版本,这里以python3.11为例,并将环境命名为manim ```shell conda create -n manim python=3.11 ``` 这时查看python环境发现base下面多了一个manim,并且显示安装路径 (可改,详见[Anaconda配置教程](https://www.bilibili.com/video/BV1bQ4y1n7sn?p=3&vd_source=e23ea3fbd74fb2fb17ad0e822816be55)) \ P.S. 可使用`conda info -e`或`conda-env list`查看当前已安装的python环境 输入 ```shell conda activate manim ``` 发现前面的`(base)`已变为`(manim)`,说明当前环境已切换到python3.11 ### (b) 使用mamba Mambaforge安装完成后,同样在Prompt (or cmd)中输入初始化命令 ```shell mamba init ``` 重启终端后剩余步骤与conda相同,将命令中的`conda`替换为`mamba`即可 不能激活python环境时也可以使用conda命令 ## Step3. 安装manimgl并测试 由于使用安装包或`pip install manimgl`会将manimlib等直接装到python环境的文件夹下,并且该release版本并非稳定版,仍存在一些bug,因此笔者fork了v1.6.1发行之后的[某版本manimgl源码](https://github.com/3b1b/manim/tree/650d49c031ec742f9da8a75e4bacc4823c1f67fa) 下载了my_manim (manim) 的源码后,命令行将当前路径改到源码根目录下,输入 ```shell pip install -e . ``` 等待安装完成后,输入 ```shell manimgl -v ``` 看到`ManimGL v1.6.1`说明安装成功。然后输入 ```shell manimgl example_scenes.py OpeningManimExample ``` 动画正常生成(可能会弹窗提示缺少相关Latex的宏包,对应安装即可) 如果下载的是manimgl的官方源码,应该会报错 ```shell ...... ValueError: operands could not be broadcast together with shapes (xx,xx) (xx,xx) ``` 这是因为numpy版本不对,将其改为1.24即可: ```shell pip uninstall numpy pip install numpy==1.24 ``` 或 ```shell pip install -U numpy==1.24 ``` ## Appendix - my_manim相较于[官方库](https://github.com/3b1b/manim/tree/650d49c031ec742f9da8a75e4bacc4823c1f67fa)更改的内容: - manimlib\tex_templates:更改了tex的字体配置,增加了对自定义字体的支持 - manimlib\my_utils:自定义工具包 - setup.cfg & requirement.txt:指定了numpy的版本 - 修复了manimlib中的部分bug - conda删除虚拟环境 ```shell conda remove -n your_env_name --all ``` 或 ```shell mamba env remove -n your_env_name ``` - 其他问题1 ```shell GLib-GIO-WARNING **: xxxxxxx: Unexpectedly, UWP app xxxxxxxx .... ``` 详见[GLib-GIO-WARNING!!!(Acer Predator)](https://github.com/3b1b/manim/issues/1656),但其实只是warning没有影响 - 其他问题2 ```shell LaTeX Error! Not a worry, it happens to the best of us. ``` 可能是没有安装使用的字体