日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python实现语音播放_用Python实现语音播报

發布時間:2023/12/19 python 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python实现语音播放_用Python实现语音播报 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

以下內容為帶著兒子一起學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,

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 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

(1)右鍵管理員身份運行cmd命令提示符:

(2)切換到E:\Python27\Scripts文件夾下,命令為:cdE:\Python27\Scripts

最上面的小紅框告訴我們當前處于管理員模式命令提示符

(3)運行python pywin32_postinstall.py -install

(4)退出命令行

參考:

總結

以上是生活随笔為你收集整理的python实现语音播放_用Python实现语音播报的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。