pip3与pyttsx3文字语音转换

今天想做个语音读取的小脚本,在网上查了一下发现python里有个pyttsx可以识别文字,

打算通过pip3 install pyttsx安装包,结果报错,

然后试了一下发现不行,去网上查了一下发现pyttsx3才行,

pip3 uninstall pyttsx3

pip3 install pyttsx3成功

这里是参考网页:https://pyttsx3.readthedocs.io/en/latest/    点击打开链接

代码如下:

[python] view plain copy
  1. # -*- coding: utf-8-*-  
  2. import pyttsx3  
  3.   
  4. engine = pyttsx3.init()  
  5. engine.say("人类真帅")  
  6. engine.runAndWait( )  

运行了一下,发现还需要安装依赖包pypiwin32

pip3 install pypiwin32成功

再次运行,它成功的说出了'人类真帅'

原文地址:https://www.cnblogs.com/chenlove/p/9008659.html