发布时间:2019-09-12 08:01:18编辑:auto阅读(4785)
1.安装python2.7
2.安装pyttsx:
pip install pyttsx
(需安装pip)
github下载地址:https://github.com/westonpace/pyttsx
3.安装pywin32(对应python版本)
下载地址:https://sourceforge.net/projects/pywin32/files/pywin32/
代码1只需pywin32
#-*-coding:utf8-*-
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
speaker.Speak("hello")
代码2:
# coding:utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
# __author__ = '郭 璞'
# __date__ = '2016/8/6'
# __Desc__ = 文字转语音输出
import pyttsx
engine = pyttsx.init()
engine.say('hello world')
engine.say('中文')
engine.runAndWait()
# 朗读一次
engine.endLoop()
上一篇: python 第三方模块
下一篇: Linux下查看python版本号
52672
52585
42725
39599
33987
30952
29746
24637
24475
22858
206°
216°
282°
267°
302°
459°
437°
449°
522°
446°