简体   繁体   English

Python文本到语音无法使用pyttsx3工作

[英]Python text to speech not working using pyttsx3

import pyttsx3
engine=pyttsx3.init('dummy')
engine.say('Hello')
engine.runAndWait()

While I am executing the following code, I am not getting any errors but I am not getting any voice from the system.Help me what I want to do.当我执行以下代码时,我没有收到任何错误,但我没有收到系统发出的任何声音。帮我做我想做的事。

This should work:这应该有效:

import pyttsx3
engine = pyttsx3.init()
engine.say("Hello")
engine.runAndWait()

Actually 'dummy' is a test driver that does not do anything.实际上'dummy'是一个不做任何事情的测试驱动程序。 Try using 'sapi5' or leave it empty.尝试使用 'sapi5' 或将其留空。
import pyttsx3 engine=pyttsx3.init('sapi5')

(or) (或者)

import pyttsx3 engine=pyttsx3.init()

Hope it works!希望它有效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM