pyttsx: No module named 'engine'

前端 未结 7 1328
青春惊慌失措
青春惊慌失措 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:59

    Combining the advice from Jacob Tsui and Jokhongir Mamarasulov worked for me. To summarize:

    In site_packages/pyttsx/init.py, modify "from engine import Engine" to

    from .engine import Engine
    

    Then, in site_packages/pyttsx/engine.py,

    1. Modify import driver to

      from . import driver
      
    2. Modify except Exception, e to

      except Exception as e
      

    And finally, in site_packages/pyttsx/driver.py modify except Exception, e to

    except Exception as e
    

    See the responses from the aforementioned authors for the rationale behind these changes.

提交回复
热议问题