问题
I tried espeak but didn't succeed and some functionalities only supported in python 2.
回答1:
Have you tried using gTTS?
The syntax for using it in Python 3.x is as follows:
from gtts import gTTS
my_tts = "Text you want to process"
tts = gTTS(text=my_tts, lang='en')
tts.save("Absolute/path/to/file.mp3")
Here is the github repo of gTTS.
回答2:
For offline use: Direct use SAPI [Windows]
Following code will help for demo...
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
speaker.Speak("Jumpman Jumpman Jumpman Them boys up to something!")
来源:https://stackoverflow.com/questions/38540005/how-to-convert-text-to-speech-in-python-3-5-on-windows-10