【问题标题】:Pyttsx text to speech - ModuleNotFoundError: No module named 'engine'Pyttsx 文本到语音 - ModuleNotFoundError:没有名为“引擎”的模块
【发布时间】:2019-01-30 15:07:43
【问题描述】:

我在 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()

初始化.py:

from engine import Engine

engine.py:

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

【问题讨论】:

    标签: python pyttsx


    【解决方案1】:

    尝试使用 pyttsx3 代替 pyttsx 首先安装 pyttsx3

    pip install pyttsx3
    

    并改变

    import pyttsx
    

    import pyttsx3
    

    test.py:

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-28
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    • 2017-12-14
    相关资源
    最近更新 更多