1

When I run pip install espeak, I get Could not find a version that satisfies the requirement espeak (from versions: ) . Anyone know how to fix this issue?

Mailer Daemon
  • 59
  • 1
  • 1
  • 9

2 Answers2

2

As suggested in a comment, espeak is not a Python package available on PyPI.

Perhaps you meant one of these:

pip install pyespeak
pip install speake  # Python 2
pip install speake3  # Python 3

If none of these packages are the one you need, you can take a look at the list here: https://pypi.org/search/?q=espeak

Samuel Dion-Girardeau
  • 2,790
  • 1
  • 29
  • 37
  • 2
    Thanks. I was actually trying out an online tutorial that implied it was a Python package. For anyone who has a similar problem in future, I used `pip install py-espeak-ng` – Mailer Daemon May 30 '18 at 15:19
0

Assuming you are after python-espeak, and are running Debian/Ubuntu, you likely want sudo apt-get install python-espeak. However, it is quite old and doesn't seem to support python3.

I'd recommend simply executing espeak directly using the subprocess module, like so:

#!/usr/bin/env python3
import subprocess

def espeak(text: str, pitch: int=50) -> int:
    """ Use espeak to convert text to speech. """
    return subprocess.run(['espeak', f'-p {pitch}', text]).returncode