美文网首页Linux学习之路Linux 相关文章我用 Linux
问题解决:matplotlib动画保存为mp4报错KeyErro

问题解决:matplotlib动画保存为mp4报错KeyErro

作者: 西风酹江月 | 来源:发表于2017-06-07 20:21 被阅读331次

    官网例子:basic_example_writer.py
    报错:
    Writer = animation.writers['ffmpeg']
    KeyError: 'ffmpeg'

    问题解决方案:安装ffmpeg
    ffmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。

    ** conda安装 **
    如果是安装了anaconda,推荐采用标准安装方法:
    conda install -c https://conda.anaconda.org/menpo ffmpeg

    从ffmpeg官网下载安装

    首先安装可能依赖的库:
    先安装yasm
    sudo apt-get install yasm

    • 然后安装libx264
      sudo apt-get install libx264-dev

    • 然后安装ffmpeg,ffmpeg有许多依赖包,需要一个一个安装

    1. libfaac
      sudo apt-get install libfaac-dev

    2. libmp3lame
      sudo apt-get install libmp3lame-dev

    3. libtheora
      aptitude install libtheora-dev

    4. libvorbis
      sudo apt-get install libvorbis-dev

    5. libxvid
      sudo apt-get install libxvidcore-dev

    6. libxext
      sudo apt-get install libxext-dev

    7. libxfixes
      sudo apt-get install libxfixes-dev

    从ffmpeg官网上下载,解压后用终端进入文件夹:
    ./configure
    make
    make install
    卸载还是进入该文件夹:
    make uninstall 即可

    相关文章

      网友评论

        本文标题:问题解决:matplotlib动画保存为mp4报错KeyErro

        本文链接:https://www.haomeiwen.com/subject/xwmafxtx.html