Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSError: libespeak.so.1: cannot open shared object file: No such file or directory

Tags:

python

pyttsx3

I am making a pyttsx3 chat bot however this error occurred:

OSError: libespeak.so.1: cannot open shared object file: No such file or directory

This error also occurred:

KeyError: None

Here is my code:

import pyttsx3

def say(sp):
    engine = pyttsx3.init()
    engine.say(sp)
    engine.runandwait()
    
say("Hello my name is Neuron")

Does anyone know how I can fix this?

like image 273
crvcio Avatar asked Sep 14 '25 15:09

crvcio


2 Answers

To install espeak on ubuntu or any of the debian based OS, enter the following command on the terminal:

sudo apt install espeak

To use pyttsx3 python library, install the following using terminal:

pip3 install pyttsx3 sudo apt install espeak pip3 install pyaudio or use sudo apt install python3-pyaudio

like image 170
dust Avatar answered Sep 16 '25 19:09

dust


I face the same problem on my ubuntu 20.04 at first install espeak or libespeak-dev

$ sudo apt install espeak

or

$ sudo apt install libespeak-dev

and after installing pyttsx3 on my venv

$ pip install pyttsx3

and it works fine with me hope it will help.

like image 32
Badrelden Ahmed Avatar answered Sep 16 '25 18:09

Badrelden Ahmed