且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Pydub(WindowsError:[错误2]系统找不到指定的文件)

更新时间:2023-01-26 08:00:04

请确保您具有ffmpeg http://www.ffmpeg.org/已安装.您可以从此官方页面获得帮助.

Make sure that you have ffmpeg http://www.ffmpeg.org/ installed. You can get help from this official page.

我能想到的另一件事是ffmpeg已安装并且在您的路径中,但不在使用pydub的进程的路径中.

Other thing that I can think of is that ffmpeg is installed and is in your path but not in the path of the process using pydub.

如果这是错误的原因,则可以直接将绝对路径设置为ffmpeg,如下所示:

If this is the reason for the error, then you can set the absolute path to ffmpeg directly like shown below:

import pydub
pydub.AudioSegment.ffmpeg = "/absolute/path/to/ffmpeg"
sound = AudioSegment.from_mp3("test.mp3")

尝试一下.