python文字转语音
pip安装pyttsx3
pip install pyttsx3
代码示例
import pyttsx3
engine = pyttsx3.init()
# engine.say("Beautiful is better than ugly.")
# engine.say("轻轻地,我走了,正如我轻轻地来...")
with open('d:/text.txt', 'r', encoding='utf8') as f:
engine.say(f.read())
engine.runAndWait()
posted on 2022-10-07 09:27 1226032602 阅读(28) 评论(0) 收藏 举报