Simple Text To Speech In Python

Simple Text To Speech In Python

Python offers a very good library to convert any text to speech. The library is known by the name “pyttsx3” and this is super easy to learn and use.


  • Works with Python version 2 and 3 both
  • Works offline i.e. without an internet connection
  • It’s very fast and works without delay
  • Supports multiple TTS engines, including Sapi5, nsss, and espeak


Inside your command prompt or your ide’s terminal type:

pip install pyttsx3

You may face this error

no module named 'pythoncom'

To resolve this you need to type

pip install pywin32

in your command prompt or ide’s terminal

If your error is one or more from the errors given below then your problem will be solved after installing pywin32

Errors may be:

  •  “No module named win32com.client”
  •  “No module named win32” or
  •  “No module named win32api”

Source Code

Now let’s have a look at the source code with explanation

# import the pyttsx module inside program
import pyttsx3

# initializing the module
engine = pyttsx3.init()

# .say() function is used to speak the text you have written 
# inside the function
engine.say("Anything you write here will be spoken by your computer during the running of the program")

# this is used to process and run the program commands


When you will run your program, you will listen to the voice which you have typed inside the .say function

So, that’s all for this tutorial

If you are facing any problem that please let us know in the comments

Keep updated to our website for more amazing content like this

Thanks for visiting

Watch YouTube Video:

Also read:

  • Make money with Python in 2022
    Did you know that data science was the fifth most common job on LinkedIn in 2017? Did you know that the demand for Python programmers is expected to grow by 19% from 2020-2021? Did you know that Python is one of the fastest-growing programming languages, and it will likely continue to expand as its adoption…
  • Top 15 Python Libraries For Data Science in 2022
    Introduction In this informative article, we look at the most important Python Libraries For Data Science and explain how their distinct features may help you develop your data science knowledge. Python has a rich data science library environment. It’s almost impossible to cover everything in a single article. As a consequence, we’ve compiled a list…
  • Top 15 Python Libraries For Machine Learning in 2022
    Introduction  In today’s digital environment, artificial intelligence (AI) and machine learning (ML) are getting more and more popular. Because of their growing popularity, machine learning technologies and algorithms should be mastered by IT workers. Specifically, Python machine learning libraries are what we are investigating today. We give individuals a head start on the new year…
  • File Explorer in Python using Tkinter
    Introduction Welcome to In this tutorial, we are going to learn File Explorer in Python using the Tkinter module. What is basically a file explorer? A file explorer is nothing but an application that is used to manage certain files and folders on your device where we can open, edit, copy, delete and move…
  • Drawing Application in Python Tkinter
    Introduction In this article, we will design and construct a basic Drawing Application in Python Tkinter GUI, where we can simply draw something on the canvas using a pencil and erase with an eraser, as well as the ability to change the thickness of a pencil and eraser. We may also modify the canvas’s background…

Avatar of Harry

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at Thank you

14 thoughts on “Simple Text To Speech In Python

  1. Hello, very nice your codes and explanations, especially, because I am learning Python, I am testing this and I get the following error, although I already installed pip install pyttsx3

    Traceback (most recent call last):
    File “C:\Carale\”, line 2, in
    import pyttsx3
    ModuleNotFoundError: No module named ‘pyttsx3’

  2. import os
    from gtts import gTTS
    Text = “Hello Thanks For Making This Website”
    print(“processing please wait….”)
    learn = gTTS(text = Text, lang = “en-us”) (“voice.mp3”)
    os.system(“start voice.mp3”)

  3. I tried code….on jupyter notebook and it did run….ty please try to make more like these.

Comments are closed.