• Register
4,020 points
8 4 1

pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.


First you have to install pyttsx3 in your system.

You can do it by typing “pip install pyttsx3” in command prompt .

Now, code for text to speech conversion is here.

import pyttsx3
engine = pyttsx3.init()

while True:
     text = input("Enter text to speak : ")




now, if you are using windows, you will write 

engine = pyttsx3.init(‘sapi5’)

for MAC users,

engine = pyttsx3.init(‘nsss’)

for Linux users, 

engine = pyttsx3.init(‘espeak’)


If you get stuck or will have any error performing the same, then plz contact me here.

For detail study on pyttsx3 you can read here.

1 Comment

This stuff is really helpful, at first how i would install and proceed to learn this because i had no technical background but the explanation there is quite simple and easy to understand so this really helped me alot "Thanks" to the creators