Python 官方文档:入门教程 => 点击学习
以下内容为带着儿子一起学python的实现记录,为自己保存下来,也希望对其他学习者有用!1. 确保已经安装Python,本例使用python,操作系统为:windows 10 专业版;2. 设置环境变量,设置两个path路径。E:\Pyt
以下内容为带着儿子一起学python的实现记录,为自己保存下来,也希望对其他学习者有用!
1. 确保已经安装Python,本例使用python,操作系统为:windows 10 专业版;
2. 设置环境变量,设置两个path路径。
E:\Python27 和E:\Python27\Scripts(为安装时选择的路径)
3. 查看Python以及pip安装成功
3.1 查看Python,开始菜单->输入cmd->输入python,正常显示如下图:
3.2查看pip,在步骤3.1中按Ctrl+C退出python,输入pip,正常显示如下图:
4. 安装pyttsx,在命令行输入pip install pyttsx,安装完成如下图:
python3,在命令行输入pip3install pyttsx3
5. 安装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 ideaand most circumstances the installation will fail. So the best method isinstall pywin32 is by downloading the .exe file from the pywin32 Source Forge WEBsite.(老的版本:)
New downloadscan now be found at https://GitHub.com/mhammond/pywin32/releases All buildsfrom Build 222 and later can be found *only* on github.(新版本)
选择好对应的版本,我安装的py2.4-amd64,因此,选择红框中的版本进行安装。
官方说明:
To downloadpywin32 binaries you must choose both the correct Python version and"bittedness".
Note that thereis one download package for each supported version of Python - please checkwhat version of Python you have installed and download the correspondingpackage.
Some packageshave a 32bit and a 64bit version available - you must download the one whichcorresponds to the Python you have installed. Even if you have a 64bitcomputer, if you installed a 32bit version of Python you must install the 32bitversion of pywin32.
To determinewhat version of Python you have, just start Python and look at the first lineof the banner. A 32bit build will look something like
Python2.7.2+ ... [MSC v.1500 32 bit (Intel)] on win32
While a 64bitbuild will look something like:
Python2.7.2+ ... [MSC v.1500 64 bit (AMD64)] on win32
我电脑查看出来的结果:
4.1 出错解决
安装时,出现如下错误:
closefailed in file object destructor:sys.excepthook is missing lost sys.stderr
解决如下:(参考:Http://www.bubuko.com/infodetail-2089657.html)
(1)右键管理员身份运行cmd命令提示符:
(2)切换到E:\Python27\Scripts文件夹下,命令为:cdE:\Python27\Scripts
最上面的小红框告诉我们当前处于管理员模式命令提示符
(3)运行python pywin32_postinstall.py -install
(4)退出命令行
参考:
http://blog.sina.com.cn/s/blog_9f0384e70102yk74.html
http://blog.csdn.net/marksinoberg/article/details/52137547
--结束END--
本文标题: 用Python实现语音播报
本文链接: https://lsjlt.com/news/190317.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0