Moviepy 无法检测到 ImageMagick?

Ton*_*hen 6 package-management python imagemagick 16.04

我是 Linux 新手。我安装了 ImageMagick 作为答案说明并且它起作用了。但是当我运行我的 python 代码时,如下所示:

from moviepy.editor import *

clip = VideoFileClip("video.mkv").subclip(50,60)
clip = clip.volumex(0.8)
txt_clip = TextClip("My Holidays 2013", fontsize = 70, color = 'white')
txt_clip = txt_clip.set_pos('center').set_duration(10)
video = CompositeVideoClip([clip, txt_clip])
video.write_videofile("modifiedVideo.mp4")
Run Code Online (Sandbox Code Playgroud)

它仍然给我这样的错误:

[MoviePy] This command returned an error !Traceback (most recent call last):
  File "tst.py", line 5, in <module>
    txt_clip = TextClip("My Holidays 2013", fontsize = 70, color = 'white')
  File "/usr/local/lib/python2.7/dist-packages/moviepy/video/VideoClip.py", line 1145, in __init__
    raise IOError(error)
IOError: MoviePy Error: creation of None failed because of the following error:

convert: not authorized `@/tmp/tmp920Byo.txt' @ error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmpUoKRUA.png' @ error/convert.c/ConvertImageCommand/3210.
.

.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
Run Code Online (Sandbox Code Playgroud)

它说ImageMagick我的电脑上没有安装(我当前的操作系统版本是Ubuntu 16.04 LTS,我的 python 版本是2.7.12)。有人给我一些帮助吗?谢谢!

tnd*_*oan 10

我有同样的问题,我也尝试了 pauljohn32 的两个答案,但它不起作用。不过,我已经解决了这个问题。

首先,我libmagick++-dev使用sudo apt install libmagick++-dev. 其次,我遵循reddit的建议。具体来说,我policy.xml使用 command:打开ImageMagick sudo vim /etc/ImageMagick-6/policy.xml,然后通过将 @ 策略从 更改<policy domain="path" rights="none" pattern="@*" /><!--<policy domain="path" rights="none" pattern="@*" /> -->

我希望它适用于你的情况