发布时间:2019-09-12 08:01:18编辑:auto阅读(4246)
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版本号
49042
48192
38917
36052
30463
27241
26256
21088
20922
19257
118°
189°
142°
803°
872°
850°
863°
819°
790°
942°