在windows10上用python播放声音。使用pyttsx包
(2016-02-02 14:46:09)
标签:
it开源 |
在windows10上用python播放声音。使用pyttsx包
1,安装python 2.7.11
https://www.python.org/
2,
设置环境变量
在设置中搜索,设置两个path路径。
C:\Python27 and
C:\Python27\Scripts
3, 安装pyttsx
widows 命令行下运行:pip
install pyttsx
4,安装pywin32.要安装对应的版本啊。
Step 2: Installing pywin32
The pyttsx library/package has a dependence
of pywin32, so you need to install this package
also. In this using pip is not a good idea and most circumstances
the installation will fail. So the best method is install pywin32
is by downloading the .exe file from the pywin32
Source Forge website.
5,安装pycharm.(可以不安装,不过,推荐安装)
https://www.jetbrains.com/pycharm/
6,运行下面代码。
import pyttsx
engine = pyttsx.init()
engine.say('Sally sells seashells by the seashore.')
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
YeS
you WIN! It works now!