0

我得到了上面的例外。谁能帮我找出原因。这是我的代码:

import pyttsx3  # pip install pyttsx3

engine = pyttsx3.init() # creating a variable named engine
#engine.say('Hello World...!') #calling that function
#engine.runAndWait() #it is also a pre build funtion used to run and wait till funtion is completed
4

1 回答 1

2

当我使用 " pip install pyttsx3" 安装模块pyttsx3时,我遇到了你描述的情况:

在此处输入图像描述

我在pip列表中看到默认安装pyttsx3的是2.90版本,所以我使用“”安装了2.71版本的pyttsx3 pip install pyttsx3==2.71。调试完代码,听到声音:“Hello World!”。

控制台的调试结果:

在此处输入图像描述

我使用的 Python 版本:Python3.7.6 和 Python3.8.3。他们都可以运行上面的代码。

于 2020-09-21T05:52:46.437 回答