So mache ich einen Chatbot/Virtual Assistant mit Python, ich war Suche nach einem Text-to-Speech-Engine für Python und gefunden pyttsx. Ich habe es mit pip heruntergeladen (wie folgt: sudo pip install pyttsx
) (Ich verwende übrigens Linux). Ich benutze Python 2.7 (Ich versuchte mit Python 3.5 gab mir den gleichen Fehler). Ich importierte es und es funktionierte, aber wenn ich (wie dieses Tutorial "sagte mir" https://pythonspot.com/en/speech-engines-with-python-tutorial/) engine = pyttsx.init()
.pyttsx pyttsx.init() funktioniert nicht
Der Code sieht wie folgt aus:
import pyttsx
engine = pyttsx.init()
engine.say('Hello There')
engine.runAndWait()
Und das ist der Fehler Ich erhalte:
Traceback (most recent call last):
File "/home/theshoutingparrot/Desktop/Programming/Python/Bots/A.I/speechtotext.py", line 2, in <module>
engine = pyttsx.init()
File "/usr/local/lib/python2.7/dist-packages/pyttsx/__init__.py", line 39, in init
eng = Engine(driverName, debug)
File "/usr/local/lib/python2.7/dist-packages/pyttsx/engine.py", line 45, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/usr/local/lib/python2.7/dist-packages/pyttsx/driver.py", line 64, in __init__
self._module = __import__(name, globals(), locals(), [driverName])
File "/usr/local/lib/python2.7/dist-packages/pyttsx/drivers/espeak.py", line 19, in <module>
import _espeak
File "/usr/local/lib/python2.7/dist-packages/pyttsx/drivers/_espeak.py", line 24, in <module>
dll = cdll.LoadLibrary('libespeak.so.1')
File "/usr/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libespeak.so.1: cannot open shared object file: No such file or directory
Jede Hilfe wäre gut, oder einen Motor nother txt-to-speech vorschlagen Danke im Voraus, wenn Sie helfen können.