import gtts
blabla = ("Spoken text")
tts = gTTS(text=blabla, lang='en')
tts.save("test.mp3")
I use above code for gTTs project in raspberry pi and I had already installed gTTs in to my pi by using below code.
pip3 install gTTs
I got below error after running py script
$ python test2.py
Traceback (most recent call last):
File "test2.py", line 3, in <module>
tts = gTTS(text=blabla, lang='en')
NameError: name 'gTTS' is not defined
So anyone please help me about this problem.
from gtts import gTTS
blabla = ("Spoken text")
tts = gTTS(text=blabla, lang='en')
tts.save("test.mp3")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.