pyttsx: No module named 'engine'

前端 未结 7 1338
青春惊慌失措
青春惊慌失措 2020-12-03 01:02

I\'m trying to install TTS package by using this. Everything was okay until I tried to execute the following command:

import pyttsx

I got b

7条回答
  •  难免孤独
    2020-12-03 01:49

    Modify site_packages/pyttsx/init.py "from engine import Engine" to

    from .engine import Engine
    

    Modify site_packages/pyttsx/engine.py "import driver" to

    from . import driver
    

    Reason: The import statement "from engine import Engine" tells python to import Engine module from directory engine. In our case engine is not a directory, it's a python file, engine.py. So we need to tell python to import this engine module from current directory (".").

提交回复
热议问题