'OSError: libespeak.so.1: cannot open shared object file: No such file or directory
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?
Solution 1:[1]
pyttsx3 uses the espeak library for speech synthesis.
The error says that python cannot find this library.
I work on Arch (Linux) and I solved this problem by:
sudo pacman -S espeak
For Ubuntu you can do it by:
sudo apt install espeak
For Windows unfortunately I don't know the answer. Maybe you can install the library from the internet.
Solution 2:[2]
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
Solution 3:[3]
sudo apt install libespeak-dev
This package provides eSpeak development files needed for compilation with the espeak shared library. Your code will works fine after install it. I had the same issu and I resolved it with this command.
Solution 4:[4]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gino Mempin |
| Solution 2 | |
| Solution 3 | |
| Solution 4 | Badrelden Ahmed |
