一、安装moviepy
pip install moviepy
二、安装imageMagick
apt-get update
apt-get install imagemagick
convert --version 如果有下面内容说说明安装成功
接下来处理报错问题
问题1:
convert-im6.q16: attempt to perform an operation not allowed by the security policy `@/tmp/tmpxts5tq4t.txt' @ error/property.c/InterpretImageProperties/3668.
convert-im6.q16: no images defined `PNG32:/tmp/tmpjh8almqq.png' @ error/convert.c/ConvertImageCommand/3258
这个是因为安全策略中不允许 @/tmp 格式的内容
解决方式:vim /etc/ImageMagick-6/policy.xml (根据自己安装的目录来,我的ImageMagick-6是在 etc 目录下面),然后将 <policy domain="path" rights="none" pattern="@*"/> 这一行注释掉,注意不要用finalshell直接双击点开文件编辑,这样编辑可能不生效
问题2:
module 'PIL.Image' has no attribute 'ANTIALIAS'
解决方式:
找到这个文件把37行的 Image.ANTIALIAS 改成 Image.LANCZOS 就ok了,