教你怎么在Pycharm上安装Manim(Pycharm+Manim)

首个教你怎么在Pycharm下安装Manim的教程

1. 安装环境

前两个都是程序员标配了。只需要去github download zip或者本地git clone一下Manim就可以。

2. 创建工程

image-20210121211054838

image-20210121211114065

把下载完成的manim放在工程主路径里,之后在pycharm的命令行中会用到。我这里的工程名字是manimPRO,按照自己取的名字在电脑上里面找到这个文件夹放进去就行。

3. 配置

最先的一步是什么,我猜大部分人不会使用git clone下载到工程目录,这会导致你的工程还未进行git初始化,所以先在上图中进行git init,当然也可以在pycharm的命令行里面进行初始化。

image-20210121211410609

这样就可以在pycharm的命令行中使用pip安装manim需要的环境。


接下来来到pycharm中,打开命令行。

image-20210121211527657

cd manim,进入到manim的目录。

image-20210121211641540

再输入pip install -e . -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

image-20210121211734607

等待下载完成即可。

4. 运行

这里给一个官方的代码,按照这个代码原封不动的运行,可以得到一个只有一个点的视频。

说明你已经安装成功了。

from manimlib.imports import *
from pathlib import Path

RESOLUTION = ""
FLAGS = f"-ps {RESOLUTION}"
SCENE = "Test"


class Test(Scene):
    def construct(self):
        self.add(Dot())
        Circle = Circle()


if __name__ == '__main__':
    script_name = f"{Path(__file__).resolve()}"
    os.system(f"manim {script_name} {SCENE} {FLAGS}")

5. 报错的原因

  1. 没进行git初始化

Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It’s also possible that there is a mismatch between the package nam
e in setup.cfg and the argument given to pbr.version.VersionInfo. Project name manimlib was given, but was not able to be found.
error in setup command: Error parsing C:\Users\14215\PycharmProjects\manimPRO\manim-master\setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or acc
ess to an upstream git repository. It’s also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name mani
mlib was given, but was not able to be found.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

  1. 没添加信任镜像源

WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead,
otherwise you may silence this warning and allow it anyway with ‘–trusted-host mirrors.aliyun.com’.
ERROR: Could not find a version that satisfies the requirement argparse (from manimlib)
ERROR: No matching distribution found for argparse

  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值