当我尝试如下所示初始化pyttsx
时,出现错误。
import pyttsx
engine = pyttsx3.init()
engine.say("hello user")
engine.runAndWait()
这是我得到的错误的回溯:
Traceback (most recent call last):
File "C:\Users\gajar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\gajar\AppData\Local\Programs\Python\Python38-32\lib\weakref.py", line 131, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/gajar/PycharmProjects/untitled/App.py", line 3, in <module>
engine = pyttsx3.init()
File "C:\Users\gajar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\gajar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\gajar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\driver.py", line 52, in __init__
self._driver = self._module.buildDriver(weakref.proxy(self))
AttributeError: module 'pyttsx3.drivers.sapi5' has no attribute 'buildDriver'