from gtts import gTTS
import speech_recognition as sr
from mpg123 import Mpg123, Out123
# class Test():
# def __init__(self):
tts = gTTS(text="How can I help you ?", lang='en')
tts.save('speak_test.mp3')
aud_file = Mpg123('speak_test.mp3')
out = Out123()
for frame in aud_file.iter_frames(out.start):
out.play(frame)
输出: 追溯(最近一次通话): 文件“ D:/Users/ASUS/PycharmProjects/intent_identifier_aud/test.py”,第10行,在 aud_file = Mpg123('speak_jarvis.mp3') init 中的文件“ C:\ Users \ ASUS \ AppData \ Local \ Programs \ Python \ Python37 \ lib \ site-packages \ mpg123.py”,第110行 self._lib = self.init_library(library_path) 文件“ C:\ Users \ ASUS \ AppData \ Local \ Programs \ Python \ Python37 \ lib \ site-packages \ mpg123.py”,init_library中的第99行 引发self.LibInitializationException('找不到libmpg123') mpg123.LibInitializationException:找不到libmpg123