【发布时间】:2017-05-12 06:11:50
【问题描述】:
大家好,提前致谢
import pyttsx
engine = pyttsx.init()
engine.say('Hello World')
engine.runAndWait()
我得到这个错误:
Traceback (most recent call last):
File "C:\Users\xxx\eclipse\workspace\Ai_Project\AI\Ai_Brain.py", line 8, in <module>
engine = pyttsx.init()
AttributeError: 'module' object has no attribute 'init'
我在 Windows 7 上使用 Python 2.7 和 eclipse neon。这是某种兼容性问题吗?我搜索了很多相关问题,但将答案应用于我的案例并没有解决错误
【问题讨论】:
-
你的工作目录中有 pyttsx.py 吗?
-
你的意思是在我的工作区文件夹中?不,我有 2 个文件 init.py 和 AI_Brain.py。如果你的意思是我是否在我的 python 安装中安装了 pyttsx,那就是。
标签: python attributeerror pyttsx