所以我正在用Python制作一个Chatbot /虚拟助手,我是 正在寻找Python的文本到语音引擎,并且找到了pyttsx。 我用pip下载了它(像这样:sudo pip install pyttsx
)(顺便说一句,我用Linux)。我正在使用Python 2.7(我尝试使用python 3.5给了我同样的错误)。 我导入它,它的工作,但是当我把(因为本教程“告诉我”https://pythonspot.com/en/speech-engines-with-python-tutorial/)engine = pyttsx.init()
。pyttsx pyttsx.init()不起作用
的代码看起来是这样的:
import pyttsx
engine = pyttsx.init()
engine.say('Hello There')
engine.runAndWait()
这是我收到的错误:
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
任何帮助将是很好的,或建议诺特尔TXT语音转换引擎 如果你能提供帮助,请提前Thx。