![](/img/trans.png)
[英]Not getting any audio output during Text to speech with Pyttsx3 module on Pycharm
[英]pyttsx3 module is not giving any output
我在使用 pyttsx3 模塊時遇到了一些問題。 起初我什至無法初始化它,我得到了這個錯誤:
File "/home/emanuele/.local/lib/python3.9/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/usr/lib/python3.9/weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/emanuele/AllInOneApp.py", line 3, in <module>
engine = pyttsx3.init()
File "/home/emanuele/.local/lib/python3.9/site-packages/pyttsx3/__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "/home/emanuele/.local/lib/python3.9/site-packages/pyttsx3/engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/home/emanuele/.local/lib/python3.9/site-packages/pyttsx3/driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/emanuele/.local/lib/python3.9/site-packages/pyttsx3/drivers/espeak.py", line 3, in <module>
import ctypes
File "/usr/lib/python3.9/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ImportError: libffi.so.8: cannot open shared object file: No such file or directory
然后我通過運行這兩個命令解決了它
pip uninstall pyttsx3
和
pip install pyttsx3==2.71
並將參數“dummy”添加到 init 函數中。 問題是現在它運行沒有錯誤,但我沒有從模塊中得到任何輸出
我終於得到了解決方案。 請參閱下面的修復程序。
運行: sudo apt install libespeak1
說明:在 ubuntu 中運行pyttsx3
需要libspeak1
包。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.