I am attempting to use a program that has the Python API to speech dispatcher as a dependency. The code fails on the line that imports the speech dispatcher Python interface:
import speechd
I am on Ubuntu 20 LTS, and have the speech dispatcher package installed, as well as python3-speechd. When using the python3 REPL, import speechd
fails with module not found.
How can I successfully get Python to recognize the bindings for speech dispatcher?
2
Answers
What tool are you using to code? (Jupyter notebook, PyCharm, etc.) I believe you need to pip install the package before you import it.
Please try one of the below:
then you can run:
Looks like you’re using Pyenv.
Versions of Python installed by Pyenv do not look for packages in the system directories (
/usr/lib/python3/...
), that’s why installingpython3-speechd
does not work in your case.So you have two choices:
speechd
with your Pyenv version. There does not seem to be an easy way to install it, so you’d have to compile Speechd yourself first, then install the built Python package withpip
.pyenv global system
(orpyenv local system
if you want it only in the current directory). Then you should be able toimport speechd
.