python-3.x - 我想修复一个 pyttsx3 程序
问题描述
我最近安装了 pyttsx3 并使用以下代码:
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
但是当我运行这个程序时,我遇到了一些问题: 在此处输入图像描述
我不知道如何处理这个:(
解决方案
试试这个程序。我对此有一些经验。
engine = pyttsx3.init('sapi5')<--- Sapi5 is Win 10 only. Find the one for your system.
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
那么这就是你让它说话的方式:
speak("I am speaking this right now")
推荐阅读
- visual-studio-code - 是否可以将 vscode 终端模拟器的工作目录与编辑器的工作目录同步?
- javascript - Jquery用换行符填充文本区域,如果没有数据则什么都没有
- c# - 带有复选框的 Wpf TreeView
- java - Android扩展按钮检测onClick
- ef-fluent-api - 一周想要efcore sql语法,流利的api方法的例子
- c++ - C++线程函数通过引用传递
- python - Python,Selenium 如何忽略 shader_cache 错误?
- node.js - 在nodejs中获取子文档时不支持的投影选项
- python - 从存储在文件中的列表格式的字符串创建 Python 中的数字列表
- reactjs - 反应让 onClick 在组件上只工作一次