首页 > 解决方案 > 我无法在 python 上运行 pyttsx3

问题描述

这是我的代码:

    import pyttsx3
    speech =pyttsx3.init()
    speech.say('hi krishna')
    speech.runandwait()

这是错误消息:

KeyError                                  Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/pyttsx3/__init__.py in init(driverName, debug)
     19     try:
---> 20         eng = _activeEngines[driverName]
     21     except KeyError:

15 frames
KeyError: None

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
/usr/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: libespeak.so.1: cannot open shared object file: No such file or directory 

谢谢你

标签: python

解决方案


推荐阅读