我正在尝试编写一个Python程序,在Mac OS 10.11.16上使用MoviePy将MP4文件转换为GIF。我使用以下命令:
import moviepy.editor as mp
我遇到了一个错误,提示我需要调用imageio.plugins.ffmpeg.download()
来下载FFmpeg。我的代码如下:
import imageio
imageio.plugins.ffmpeg.download()
这导致了以下错误:
Imageio: 'ffmpeg.osx' was not found on your computer; downloading it now.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
imageio.plugins.ffmpeg.download()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 55, in download
get_remote_file('ffmpeg/' + FNAME_PER_PLATFORM[plat])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/core/fetching.py", line 121, in get_remote_file
_fetch_file(url, filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/core/fetching.py", line 177, in _fetch_file
os.path.basename(file_name))
OSError: Unable to download 'ffmpeg.osx'. Perhaps there is a no internet connection? If there is, please report this problem.
我肯定有互联网连接。我找到了这个链接,并尝试使用Homebrew和静态构建进行安装,但都没有成功。似乎自己编译对我来说有点太高级了(我只是简单地研究了一下)。我在IDLE上使用了
imageio.plugins.ffmpeg.download()
。我读到过使用PyCharm运行MoviePy代码的方法,但我得到了相同的初始错误。ffmpeg目前位于我的/usr/local/bin
文件夹中。欢迎任何建议。感谢您的帮助。编辑:我正在使用Python 3.6.1