简介
根据文档可知, manim目前分为两个版本, 一个是由3Blue1Brown维护更新的最新版本的manimgl, 另一个是稳定的社区版本manim or manimce. 两个版本在安装和使用上都有些不同, 不要搞混.
Linux manim ERROR
No package ‘pangocairo’ found
Getting requirements to build wheel ... errorerror: subprocess-exited-with-error× Getting requirements to build wheel did not run successfully.│ exit code: 1╰─> [31 lines of output]Package pangocairo was not found in the pkg-config search path.Perhaps you should add the directory containing `pangocairo.pc'to the PKG_CONFIG_PATH environment variableNo package 'pangocairo' found
看报错信息, 是pangocairo的问题, 手动下载编译安装
 从官网下载pango-1.51.0.
 解压后进入文件夹内
 
 可知是使用meson和ninjia构建的.
 首先下载
pip3 install meson ninja
构建的一般过程如下:
# 通过--prefix指定install路径, 不然默认装到系统路径(无权限) meson setup $builddir --prefix=${path to install}ninja -C $builddirninja -C $builddir install
可在文件夹下新建一个build作为$builddir, install位置可以就设为pango-1.51.0文件夹.
 按步骤安装完毕后, 在.bashrc中写入pangocairo.pc所在的位置
 先查找
$ find ./ -name "pangocairo.pc"
./lib/x86_64-linux-gnu/pkgconfig/pangocairo.pc
./build/meson-private/pangocairo.pc
所以在.bashrc中写入
# pkg-config path
export PKG_CONFIG_PATH="/path/to/pango-1.51.2/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"
先source ~/.bashrc再次进行pip install manim即可.
Original error: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory
类似地, 在.bashrc加入环境变量
# 修改为对应的pango路径
export LD_LIBRARY_PATH="/pango/path/pango-1.51.2/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH"
ImportError: /lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: ffi_type_uint32, version LIBFFI_BASE_7.0
根据comment, 设置环境变量
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libffi.so.7
Unknown encoder ‘libx264’
卸载重装ffmpeg即可
FileNotFoundError: [Errno 2] No such file or directory: ‘xdg-open’
视频已经成功生成, 应该是在服务器终端无法自动打开的意思.
 -p参数表示Previewed, 去掉该参数即可. 并且在本应用中使用后端投放到web UI上, 无需预览功能.
 下面是无root用户尝试解决/安装xdg-open的记录.
这个comment说更新sededu, 下载之后好像不起作用.
 参考这个, 尝试手动安装xdg-utils.
 下载xdg-utils-v1.2.1
./configure --prefix=/path/to/install
make && make install -j8
/usr/bin/xmlto: not found/home/stlinpeiyang/lpy22/software/xmlto-0.0.28
安装xmlto
尝试从这里尝试安装xmlto
./configure --prefix=/path/to/install
make && make install -j8
没问题, 填入环境变量再次尝试安装xdg
 失败 暂时no way
直接安装deb包
从这里下载xdg-utils_1.1.3
 使用
# 应该要使用绝对路径才有效
dpkg -x xdg-utils_1.1.3-2ubuntu1_all.deb /path/to/install
然后就会在路径下生成usr/bin等文件夹和文件
(py_LLM) user@ubuntu:~/lpy22/software$ ls .local/usr/bin/
browse            xdg-desktop-menu  xdg-icon-resource  xdg-open         xdg-settings
xdg-desktop-icon  xdg-email         xdg-mime           xdg-screensaver
然后加入环境变量再激活即可.
export PATH=$PATH:/path/to/.local/usr/bin/
安装cairo
下载文件cairo-1.18.0
 error: unknown type name ‘pixman_dither_t’; did you mean ‘pixman_filter_t’?954 |     pixman_dither_t pixman_dither = _cairo_dither_to_pixman_dither (source->dither);|     ^~~~~~~~~~~~~~~|     pixman_filter_t
../src/cairo-image-surface.c:954:37: error: implicit declaration of function ‘_cairo_dither_to_pixman_dither’ [-Werror=implicit-function-declaration]954 |     pixman_dither_t pixman_dither = _cairo_dither_to_pixman_dither (source->dither);|                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/cairo-image-surface.c:955:5: error: implicit declaration of function ‘pixman_image_set_dither’; did you mean ‘pixman_image_set_filter’? [-Werror=implicit-function-declaration]955 |     pixman_image_set_dither (surface->pixman_image, pixman_dither);|     ^~~~~~~~~~~~~~~~~~~~~~~|     pixman_image_set_filter
cc1: some warnings being treated as errors
[171/722] Compiling C object src/libcairo.so.2.11800.0.p/cairo-pdf-surface.c.o
ninja: build stopped: subcommand failed.
一般系统都自带cairo 遂放弃.
manimgl ERROR
screeninfo.common.ScreenInfoError: No enumerators available
manimgl好像是需要一个窗口来进行交互或预览, 所以在Linux服务器跑不了.
 文档
 
 在服务器尝试manimgl报错如下:
python3.10/site-packages/screeninfo/screeninfo.py", line 32, in get_monitorsraise ScreenInfoError("No enumerators available")
screeninfo.common.ScreenInfoError: No enumerators available
目前还没解决
 关于Pyglet Window
FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Users\PLA\AppData\Local\Temp\Tex\42c962cc458aefe6.log’
在Windows下若不是安装在C盘, 则会显示找不到tex log文件. 解决方法如下:
 在default_config.yml文件中
# Manim often generates tex_files or other kinds of serialized data# to keep from having to generate the same thing too many times.  By# default, these will be stored at tempfile.gettempdir(), e.g. this might# return whatever is at to the TMPDIR environment variable.  If you want to# specify them elsewhere,temporary_storage: "E:\\projects\\manim\\media"
在manim文件夹下新建media文件夹添加为temporary_storage即可.