[英]ModuleNotFoundError: No module named 'engine' while running pyttsx
When I run this code I always get this error: ModuleNotFoundError: No module named 'engine'
.当我运行此代码时,我总是收到此错误: ModuleNotFoundError: No module named 'engine'
。
import pyttsx
engine = pyttsx.init()
engine.say('hello world')
Does anyone know why this is happening and how to fix it?有谁知道为什么会发生这种情况以及如何解决?
Use pyttsx3
package instead that supports both python 2 and 3. You can install it for example with pip install pyttsx3
on your system.使用pyttsx3
package 而不是同时支持 python 2 和 3。例如,您可以使用pip install pyttsx3
来安装它。
import pyttsx3
engine = pyttsx3.init()
engine.say("hello world")
engine.runAndWait()
you have to use import pyttsx3
你必须使用import pyttsx3
The Python "ModuleNotFoundError: No module named 'click'" occurs when we forget to install the click module before importing it or install it in an incorrect environment. Python "ModuleNotFoundError: No module named 'click'" 当我们在导入之前忘记安装 click 模块或将其安装在不正确的环境中时会发生。 To solve the error, install the module by running the pip install click command.要解决该错误,请运行 pip install click 命令安装模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.