发布时间:2019-09-12 08:01:18编辑:auto阅读(4383)
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版本号
50554
49873
40462
37452
31886
28766
27684
22467
22462
20775
560°
1184°
965°
891°
1150°
1007°
1631°
3023°
2744°
2067°