当我尝试添加文本剪辑时出现关于 ImageMagick With Python/MoviePy 的错误

Getting error about ImageMagick With Python/MoviePy when I try add text clip

我正在使用 python 3.8.5 以及最新版本的 imagemagick 和 moviepy

错误(对比代码):

Traceback (most recent call last):
  File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\video\VideoClip.py", line 1137, in __init__
    subprocess_call(cmd, logger=None)
  File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\tools.py", line 46, in subprocess_call     
    proc = sp.Popen(cmd, **popen_params)
  File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:/Users/edgib102/source/repos/Reddit-tts-video/Python/GetComments.py", line 40, in <module>
    TextClip = TextClip('TextTxt', fontsize=100, color = 'white')
  File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\video\VideoClip.py", line 1146, in __init__
    raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:

[WinError 2] The system cannot find the file specified.

.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

代码:

TextClip = TextClip('TextTxt', fontsize=100, color = 'white')
TextClip = TextClip.set_position('center').set_duration(10)

非常感谢任何帮助,还有完整的代码here

已解决。只需要将magick.exe文件路径设置为default_config.py里面的变量即可。您可以在 moviepy 文件夹中找到它。