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()
标签:文字,engine,pyttsx3,python,say,语音,pip
From: https://www.cnblogs.com/xiadongzhi/p/16759090.html