问题
I am still a novice when it comes to python, and recently I have attempted to construct a personal assistant. I am using the PyTTSX module, but when I attempt to initialize the package, I receive this error:
****File "C:\Python34\lib\site-packages\pyttsx\driver.py", line 64, in init self._module = import(name, globals(), locals(), [driverName]) ImportError: No module named 'drivers**'**
Any feedback would be greatly appreciated.
回答1:
You've probably downloaded the version of PyTTSX from the website, which was built for Python 2. The updated version can be found on GitHub here. Copy the contents of pyttsx/pyttsx into your pythonXX/Lib/site-packages/pyttsx folder and you should be good to go.
回答2:
There is now a python3 compatible version of pyttsx and is called pyttsx3
just use pip install pyttsx3
Its usage is almost same as that of pyttsx
import pyttsx3
engine = pyttsx3.init()
engine.say("hello")
engine.runAndWait()
来源:https://stackoverflow.com/questions/43012023/pyttsx-error-cannot-find-module-named-drivers