如何在Python 3.7中运行manim示例?

问题描述

我正在尝试使用Windows 10和Python 3.7运行manim。我遵循了

的指示

https://www.youtube.com/watch?v=ZltiKHFWmv8&t=695s

下载了MikTex和Sox,并成功安装了所有要求。

C:\Users\...>python -m pip install -r manim\requirements.txt
Requirement already satisfied: argparse in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 1)) (1.4.0)
Requirement already satisfied: colour in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 2)) (0.1.5)
Requirement already satisfied: numpy in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 3)) (1.19.1)
Requirement already satisfied: Pillow in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 4)) (7.0.0)
Requirement already satisfied: progressbar in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 5)) (2.5)
Requirement already satisfied: scipy in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 6)) (1.4.1)
Requirement already satisfied: tqdm in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 7)) (4.47.0)
Requirement already satisfied: opencv-python in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 8)) (4.3.0.36)
Requirement already satisfied: pycairo in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 9)) (1.19.1)
Requirement already satisfied: pydub in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 10)) (0.24.1)
Requirement already satisfied: pygments in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 11)) (2.6.1)
Requirement already satisfied: pyreadline in c:\users\hallo.desktop-4ovso14\anaconda3\lib\site-packages (from -r manim\requirements.txt (line 12)) (2.1)

我尝试了以下变体来运行SquaretoCircle示例:

C:\Users\...>python -m manimlib example_scenes.py SquaretoCircle -pl
C:\Users\...\Anaconda3\python.exe: No module named manimlib.__main__; 'manimlib' is a package and cannot be directly executed

产生错误

 C:\Users\...>python -m manim example_scenes.py SquaretoCircle -pl
C:\Users\...\Anaconda3\python.exe: No module named manim.__main__; 'manim' is a package and cannot be directly executed

产生错误

C:\Users\...>python3 -m manim example_scenes.py SquaretoCircle -pl

什么都不做。

在example_scenes.py的末尾添加SquaretoCircle()并运行它确实会显示类似的内容

Animation 1: TransformSquare:  67%|######6   | 40/60 [00:00<00:00,60.62it/s]

最后产生

Played 3 animations

显示所需视频。

感谢您的帮助!

解决方法

我认为问题是您没有从Manim目录运行manim命令。为此,必须将目录更改为manim目录(可能只需在命令提示符下键入cd manim

,

如果您有Played 3 Animations,则很可能在与该文件相同的目录中创建了一个media文件夹,将在其中创建视频文件。

我在.\media\videos\1440p60\SquareToCircle.mp4上找到了文件

PS。我知道这应该是评论,但我没有足够的声誉来做到这一点。

,

我不知道为什么,但是在pycharms终端中运行python -m manim example_scenes.py SquareToCircle -pl并不会产生预期的结果。

仍然感谢您的答复。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...