管理类联考——数学——趣味篇——可视化

Manim: 一个数学可视化的动画引擎
官网:https://3b1b.github.io/manim/index.html

名词解析

  1. python3.7是python语言的解释器, 运行python程序的环境必备品. 这个没啥说的,大家都能懂. 虽然官方建议3.7,但是我用3.8发现也没问题.考虑未来的历史进程,大伙最好还是装3.8的版本吧.
  2. pip ,用来管理包(又叫"库").python的伟大之处在于其免费(点赞也不要钱). 所以人人可用, 大家都用, 就有人们开发出来了各种强大的python库.使用这些库我们就可以用少量代码实现人脸识别之类的高级功能. 解放了人类的劳动力到更高级的工作上,而不是天天写重复的低级代码. 而这些库, 一般就是用pip来安装的. 现在介绍pip,后文将教大家咋用. 如果你学过python的话,应该已经会用了.
  3. FFmpeg, 著名的开源视频流处理内核. 内核代表这东西几乎无法独立运行. 但是它却可以作为其他程序的心脏去工作.比如作为VLC, 或者一些录屏软件,剪辑软件的内核. Manim的视频渲染就是基于它的接口的.
  4. sox,一个小巧的用于处理音频的软件.
  5. TeX宏集. 对于大部分人来说可能比较陌生. 这个是用来用编程的方式输出高质量论文的一种语言/程序. 尤其擅长渲染复杂的公式. Manim需要TeX环境处理公式和文字. 不像Microsoft office word 那样的所见即所得文字处理程序, TeX通过代码描述文章,然后直接渲染出来可视化的效果.比如MiKTeX直接输出pdf文档,Manim直接输出图片或者视频.

借鉴:做出高逼格的数学动画——一起来学manim·入门篇(一)

安装Manim软件

借鉴:Python视频制作引擎Manim安装教程

就借鉴这个就行:https://zhuanlan.zhihu.com/p/181536479

通过git bash运行下面命令【git bash安装看这里】

git clone https://github.com/3b1b/manim.git
cd manim
# 安装python依赖
pip install -e .
python -m pip install -r requirements.txt

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

ffmpeg

在这里插入图片描述

sox

在这里插入图片描述

Tex支持

pycairo

在这里插入图片描述

全局使用manimlib

在这里插入图片描述
调整区域配置,解决上述问题
在这里插入图片描述
在这里插入图片描述

下载源代码

在这里插入图片描述
git bash失败,就得尝试zip下载,多尝试几次
在这里插入图片描述

路径不对
在这里插入图片描述

在这里插入图片描述

PS C:\Users\18826> manim example_scenes.py SquareToCircle -p
Traceback (most recent call last):
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\Scripts\manim.exe\__main__.py", line 7, in <module>
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\site-packages\manimlib\__init__.py", line 9, in main
    config = manimlib.config.get_configuration(args)
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\site-packages\manimlib\config.py", line 155, in get_configuration
    module = get_module(args.file)
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\site-packages\manimlib\config.py", line 150, in get_module
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 846, in exec_module
  File "<frozen importlib._bootstrap_external>", line 982, in get_code
  File "<frozen importlib._bootstrap_external>", line 1039, in get_data
FileNotFoundError: [Errno 2] No such file or directory: 'example_scenes.py'

测试

在这里插入图片描述
出现下述动态图
在这里插入图片描述

ManimGL v1.6.1
[08:32:12] INFO     Using the default configuration file, which   config.py:362
                    you can modify in
                    `c:\users\18826\manim\manimlib\default_config
                    .yml`
           INFO     If you want to create a local configuration   config.py:363
                    file, you can create a file named
                    `custom_config.yml`, or run `manimgl
                    --config`
           WARNING  You may be using Windows platform and have    config.py:327
                    not specified the path of
                    `temporary_storage`, which may cause OSError.
                    So it is recommended to specify the
                    `temporary_storage` in the config file (.yml)
[08:32:13] WARNING  You may be using Windows platform and have    config.py:327
                    not specified the path of
                    `temporary_storage`, which may cause OSError.
                    So it is recommended to specify the
                    `temporary_storage` in the config file (.yml)
           INFO     Using the default configuration file, which   config.py:362
                    you can modify in
                    `c:\users\18826\manim\manimlib\default_config
                    .yml`
           INFO     If you want to create a local configuration   config.py:363
                    file, you can create a file named
                    `custom_config.yml`, or run `manimgl
                    --config`
           WARNING  You may be using Windows platform and have    config.py:327
                    not specified the path of
                    `temporary_storage`, which may cause OSError.
                    So it is recommended to specify the
                    `temporary_storage` in the config file (.yml)
[08:32:18] WARNING  You may be using Windows platform and have    config.py:327
                    not specified the path of
                    `temporary_storage`, which may cause OSError.
                    So it is recommended to specify the
                    `temporary_storage` in the config file (.yml)
Traceback (most recent call last):
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\Scripts\manimgl.exe\__main__.py", line 7, in <module>
  File "C:\Users\18826\manim\manimlib\__main__.py", line 25, in main
    scene.run()
  File "C:\Users\18826\manim\manimlib\scene\scene.py", line 160, in run
    self.construct()
  File "example_scenes.py", line 29, in construct
    IntegerMatrix(matrix, include_background_rectangle=True),
  File "C:\Users\18826\manim\manimlib\mobject\matrix.py", line 204, in __init__
    super().__init__(matrix, element_alignment_corner=element_alignment_corner, **kwargs)
  File "C:\Users\18826\manim\manimlib\mobject\matrix.py", line 99, in __init__
    self.add_brackets(bracket_v_buff, bracket_h_buff)
  File "C:\Users\18826\manim\manimlib\mobject\matrix.py", line 144, in add_brackets
    brackets = Tex("".join((
  File "C:\Users\18826\manim\manimlib\mobject\svg\tex_mobject.py", line 57, in __init__
    super().__init__(
  File "C:\Users\18826\manim\manimlib\mobject\svg\string_mobject.py", line 68, in __init__
    super().__init__(
  File "C:\Users\18826\manim\manimlib\mobject\svg\svg_mobject.py", line 76, in __init__
    self.init_svg_mobject()
  File "C:\Users\18826\manim\manimlib\mobject\svg\svg_mobject.py", line 105, in init_svg_mobject
    submobs = self.mobjects_from_file(self.get_file_path())
  File "C:\Users\18826\manim\manimlib\mobject\svg\string_mobject.py", line 78, in get_file_path
    return self.get_file_path_by_content(self.get_content(is_labelled))
  File "C:\Users\18826\manim\manimlib\mobject\svg\tex_mobject.py", line 85, in get_file_path_by_content
    return tex_content_to_svg_file(
  File "C:\Users\18826\manim\manimlib\utils\tex_file_writing.py", line 82, in tex_content_to_svg_file
    with display_during_execution("Writing " + short_tex):
  File "C:\Users\18826\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "C:\Users\18826\manim\manimlib\utils\tex_file_writing.py", line 153, in display_during_execution
    max_characters = os.get_terminal_size().columns - 1
OSError: [WinError 6] 

检验Manim是否安装成功

1.创建一个名为example.py 的文件,把以下内容复制进去

from manim import *
 
 
class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        square = Square()
        square.flip(RIGHT)
        square.rotate(-3 * TAU / 8)
        circle.set_fill(PINK, opacity=0.5)
 
        self.play(Create(square))
        self.play(Transform(square, circle))
        self.play(FadeOut(square))

2.在刚才创建的example.py所在的文件夹里边右键运行【在终端打开】

执行遇到问题

no module named “manimlib”

在这里插入图片描述
在这里插入图片描述
需要将该文件放到软件安装的目录下,比如,本次软件安装在自己创建的manim文件夹中
在这里插入图片描述

在这里插入图片描述

【manim】导入库时出现ModuleNotFoundError: No module named‘manimlib.XXX‘解决方法

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/46522.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

力扣题库刷题笔记75--颜色分类

1、题目如下&#xff1a; 2、个人Pyhon代码实现如下&#xff1a; 第一种思路是取巧&#xff0c;通过计数0、1、2的个数&#xff0c;去替换nums 备注第10行代码在本地可以跑过&#xff0c;但是力扣跑不过&#xff0c;所以就用了第10-16行代码进行替换 第二种思路是通过冒泡排序去…

小程序创建

1&#xff0c;下载HBuilder X ;(3.8.7) HBuilderX-高效极客技巧 2,下载模板&#xff08;不选云服务的&#xff09;&#xff1b; 3&#xff0c;运行-运行到小程序模拟器&#xff1b; 4&#xff0c;安装小程序开发工具&#xff1b; 5&#xff0c;选择稳定版-windows64版&…

springboot集成

maven配置 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency><groupId>org.apache.commons</groupId><artifactId>…

【GPT4结对编程】word文档导出功能GPT4来实现

需求背景 最近产品增加了一个导出word文档的需求&#xff0c;之前有导出过pdf格式、excel格式、csv格式&#xff0c;但还没导出过word文档。 开源框架调研 我们的后端服务主要是用golang&#xff0c;因此首先想到的是golang相关的开源工具&#xff0c;找到2个。 unioffice …

第二天 kali代理配置

文章目录 环境一、虚拟机网络模式&#xff08;1&#xff09;NAT&#xff08;2&#xff09;NAT模式&#xff08;3&#xff09;桥接模式&#xff08;4&#xff09;仅主机模式&#xff08;5&#xff09;总结 二、配置代理&#xff08;桥接模式&#xff09;1、基础设置2、虚拟机浏览…

【iOS】Cocoapods的安装以及使用

文章目录 前言一、Cocoapods的作用二、安装Cocoapods三、使用Cocoapods总结 前言 最近笔者在仿写天气预报App时用到了api调用数据&#xff0c;一般的基本数据类型我们用Xcode中自带的框架就可以转换得到。但是在和风天气api中的图标的格式为svg格式。 似乎iOS13之后Xcode中可…

kafka面试题

kafka基本概念 Producer 生产者&#xff1a;负责将消息发送到 BrokerConsumer 消费者&#xff1a;从 Broker 接收消息Consumer Group 消费者组&#xff1a;由多个 Consumer 组成。消费者组内每个消费者负责消费不同分区的数据&#xff0c;一个分区只能由一个组内消费者消费&am…

Linux常用命令——dris命令

在线Linux命令查询工具 dris 显示和清空目录堆栈中的内容 补充说明 dris命令用于显示和清空目录堆栈中的内容。 语法 dris(选项)选项 n&#xff1a;显示从左边算起第n笔的目录&#xff1b; -n&#xff1a;显示从右边算起第n笔的目录&#xff1b; -l&#xff1a;显示目录…

2023年深圳杯数学建模 D题 基于机理的致伤工具推断

致伤工具的推断一直是法医工作中的热点和难点。由于作用位置、作用方式的不同&#xff0c;相同的致伤工具在人体组织上会形成不同的损伤形态&#xff0c;不同的致伤工具也可能形成相同的损伤形态。致伤工具品种繁多、形态各异&#xff0c;但大致可分为两类&#xff1a;锐器&…

项目——负载均衡在线OJ

目录 项目介绍开发环境所用技术项目宏观结构编写思路1. 编写compile_server1.1 编译模块编写1.2 运行功能1.3compile_runner 编译与运行1.4 编写compile_server.cpp调用compile_run模块&#xff0c;形成网络服务 2. 编写基于MVC的oj_server2.1 oj_server.cpp的编写2.2 oj_model…

如何安装多个版本的python,python可以装两个版本吗

这篇文章主要介绍了可不可以在同一台计算机上安装多个python版本&#xff0c;具有一定借鉴价值&#xff0c;需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获&#xff0c;下面让小编带着大家一起了解一下。 1、不同版本的python不能安装到同一台计算机上 可以的&#…

Hibernate Validator-校验注解使用归纳

文章目录 前言java-校验注解使用归纳1. 概述2. 引入依赖3. 手动抓取校验错误信息示例4. 自定义校验注解编写示例5. 统一配置校验错误信息示例 前言 如果您觉得有用的话&#xff0c;记得给博主点个赞&#xff0c;评论&#xff0c;收藏一键三连啊&#xff0c;写作不易啊^ _ ^。  …

【iOS】App仿写--管理系统

文章目录 前言一、账号界面二、功能界面三、添加功能四、删除功能五、更改功能六、查找功能七、排序功能八、退出功能总结 前言 在日常生活中&#xff0c;如果用文字来记述与管理我们数据会十分麻烦&#xff0c;并且人工成本较高&#xff0c;这里笔者给出一种管理系统的模版&a…

[回馈]ASP.NET Core MVC开发实战之商城系统(二)

经过一段时间的准备&#xff0c;新的一期【ASP.NET Core MVC开发实战之商城系统】已经开始&#xff0c;在之前的文章中&#xff0c;讲解了商城系统的整体功能设计&#xff0c;页面布局设计&#xff0c;环境搭建&#xff0c;系统配置&#xff0c;及首页商品类型&#xff0c;bann…

【iOS】—— RunLoop和多线程相关问题总结

RunLoop 1. 讲讲RunLoop&#xff0c;项目中有用到过吗&#xff1f; RunLoop 的基本作用&#xff1a;保持程序的持续运行&#xff0c;节省 CPU 的资源&#xff0c;提高程序的性能 &#xff08; 没有事情&#xff0c;就请休眠&#xff0c;不要功耗。有事情&#xff0c;就处理&a…

二、SQL-6.DCL-1).用户管理

一、DCL介绍 Data Control Language 数据控制语言 用来管理数据库 用户、控制数据库的 访问权限。 二、语法 1、管理用户 管理用户在系统数据库mysql中的user表中创建、删除一个用户&#xff0c;需要Host&#xff08;主机名&#xff09;和User&#xff08;用户名&#xff0…

json-server创建静态服务器2

上次写的 nodejs创建静态服务器 这次再来个v2.0 利用json-server很方便就可以实现。 vscode打开文件夹&#xff0c;文件夹所在终端&#xff1a; json-server.cmd --watch db.json 这里视频教程是没有上述命令标红的&#xff0c;但是会报错&#xff0c;具体不详&#xff0c…

Docker私有仓库部署与管理

目录 Docker--harbor Harbor 简介 Harbor 部署 1. 部署 Docker-Compose 服务 2. 部署 Harbor 服务 维护管理Harbor 1. 通过 Harbor Web 创建项目 2. 创建 Harbor 用户 3. 查看日志 4. 修改 Harbor.cfg 配置文件 5. 移除 Harbor 服务容器同时保留镜像数据/数据库&…

Unity Profiler或UPR连接WebGL应用出错

问题 在使用Unity Build出WebGL应用进行性能测试的时候&#xff0c;勾选上了 Development Build和Autoconnect Profiler&#xff0c;分别使用Profiler和UPR进行测试 现象 使用Profiler测试时&#xff0c;就收到几帧&#xff0c;然后就没了 使用UPR进行测试时&#xff0c;在…

python简单入门

python简单入门 文章目录 python简单入门0. 地址链接1. 官网2.2. 下载地址3. 官方文档 1. 第一章1.1 python解释器1.2 基础语法1.2.1 常见数据类型1.2.2 强制类型转换1.2.3 注释1.2.4 运算符1.2.5 字符串1.2.5.1 字符串的定义1.2.5.2 字符串拼接1.2.5.3 格式化字符串1.2.5.3 精…