所以我正在用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。