最近一个项目中用到了moviepy,他除了需要依赖ffmpeg之外,还需要依赖一个叫imagemagick的库。
这个imagemagick库如果没有安装好,项目在跑时,很有可能会抛出类似这种异常:
This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn’t specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect
抛出这个异常,经过我一个星期的测试,几乎就可以确定,就是你的imagemagick没安装好,或者说即使imagemagick安装好了,moviepy中也是会报上面这个错误。
问题分析:
这个错其实并不意味着你的imagemagick没有安装好,因为肯定有小伙伴发现自己终端敲magick明明有反应,但是项目就是报这个错误,而且肯定也有小伙伴尝试去修改policy.xml这个文件了,但是发现也没什么用。其实经过我分析,出现这个问题大概率是imagemagick安装好了,但是magick需要的一些处理pdf,ttf…的一些库系统中没有,你可以敲个magick --version看看结果,看看这里的依赖库是否和我的一样,如果少了,那大概率你遇到的问题和我一样
解决方法:
https://mp.weixin.qq.com/s?__biz=Mzk0MTYxNjEyOA==&mid=2247483836&idx=1&sn=02499306ed8130779767afd4afc46632&chksm=c2cefcd3f5b975c55c8c6f573024718fc4854c122d34c6a19eb393531fe2c7799c4fbad822ea&token=2035017809&lang=zh_CN#rd