我在代码中使用pyttsx3。我的代码工作正常,但是当我使用py2exe生成.exe并运行生成的.exe文件时,出现以下错误:
Traceback (most recent call last):
File "hello.py", line 2, in <module>
File "pyttsx3\__init__.pyc", line 46, in init
File "pyttsx3\engine.pyc", line 52, in __init__
File "pyttsx3\driver.pyc", line 77, in __init__
File "importlib\__init__.pyc", line 37, in import_module
ImportError: No module named drivers.sapi5
我的python脚本如下:
import pyttsx3
e = pyttsx3.init()
e.setProperty('voice', 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0')
e.say("hello")
e.runAndWait()
我正在使用python2.7.14