嗨大家,感謝屬性提前Pyttsx:AttributeError的: '模塊' 對象有沒有 'init' 的
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霓虹燈。這是一種兼容性問題嗎?我已經搜索了很多相關的問題,但在我的情況下,將問題的答案並沒有修復錯誤
你的工作目錄中有pyttsx.py嗎? – gushitong
通過你的意思是在我的工作區文件夾?不,在那裏我有2個文件_init_.py和AI_Brain.py。如果你的意思是我是否在我的python安裝中安裝pyttsx,那是肯定的。 –