【笔记】Python通过pyttsx3调用系统语音助手文字转语音
前言
Python通过pyttsx3调用系统语音助手文字转语音
下载依赖
文字转语音
1 | pip3 install pyttsx3 |
MacOS
1 | pip3 install pyobjc |
Windows
1 | pip3 install pywin32 |
文字转语音
1 | import pyttsx3 |
踩坑
- 报错:
AttributeError: 'super' object has no attribute 'init' sys:1: UninitializedDeallocWarning: leaking an uninitialized object of type NSSpeechDriver
解决问题
- 将
site-packages/pyttsx3/drivers/nsss.pypyttsx3源码第15行注释
1 | # self = super(NSSpeechDriver, self).init() |