from gtts import gTTS
import os
file = open("aaa.txt","r").read()
speech = gTTS(text=file, lang='en', slow=False)
speech.save("aaa.mp3")
os.system("aaa.mp3")
1、需要安装gTTs
pip install gTTS
2、需要科学上网
gtts是将文字转化为语音,但是需要在VPN下使用。这个因为要接谷歌服务器。
3、声音很好听