首页 文章

Pyttsx文本到语音 - ModuleNotFoundError:没有名为'engine'的模块

提问于
浏览
0

我在Win10上使用Python3.7 . 我想使用Pyttsx,但它显示错误 . 你知道如何解决这个问题吗?

错误:

Traceback(最近一次调用最后一次):文件“C:\ Python37 \ myTest \ test.py”,第2行,导入pyttsx文件“C:\ Python37 \ lib \ site-packages \ pyttsx__init __ . py”,第18行,来自引擎导入引擎ModuleNotFoundError:没有名为'engine'的模块

test.py:

import pyttsx
engine = pyttsx.init()
engine.say('Good morning.')
engine.runAndWait()

init .py:

from engine import Engine

engine.py:

class Engine(object):
def __init__(self, driverName=None, debug=False):

1 回答

  • 1

    尝试使用pyttsx3而不是pyttsx首先安装pyttsx3

    pip install pyttsx3
    

    并改变

    import pyttsx
    

    对于

    import pyttsx3
    

    test.py:

    import pyttsx3
    engine = pyttsx3.init()
    engine.say('Good morning.')
    engine.runAndWait()
    

相关问题