我正在尝试使用 pydub 来获取音频文件中每个单词的时间,但是 python 向我抛出了 FileNotFoundError
编码:
from pydub import AudioSegment
from pydub.silence import detect_nonsilent
path = "E:/PyApps/New/PythonApplication1/OSR_us_000_0010_8k.wav"
audio_segment = AudioSegment.from_wav(path)
错误:
回溯(最后一次调用):文件“E:\PyApps\New\PythonApplication1\module1.py”,第 5 行,在 audio_segment = AudioSegment.from_wav(path) 文件“C:\Users\Dean\AppData\Local\Programs \Python\Python39\lib\site-packages\pydub\audio_segment.py",第 808 行,在 from_wav return cls.from_file(file, 'wav', parameters=parameters) File "C:\Users\Dean\AppData\Local \Programs\Python\Python39\lib\site-packages\pydub\audio_segment.py”,第 728 行,在 from_file info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit) 文件“C:\Users\Dean\AppData\Local\Programs\ Python\Python39\lib\site-packages\pydub\utils.py",第 274 行,在 mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) 文件“C:\Users\Dean\AppData \Local\Programs\Python\Python39\lib\subprocess.py",第 951 行,在初始化中 self._execute_child(args,可执行文件,preexec_fn,close_fds,文件“C:\Users\Dean\AppData\Local\Programs\Python\Python39\lib\subprocess.py”,第 1420 行,在 _execute_child hp、ht、pid、tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] 系统找不到指定的文件
奇怪的是,我已经在正确的文件夹中找到了错误中指定的所有文件,但由于某种原因它仍然找不到它们。