不可能使用pyttsx3:没有名为' pywintypes'的模块,但安装了pywin32
我尝试在Python 3.9.13中使用语音合成[MSC V.1929 64位(AMD64)]。
如果我很好地理解, pyttxs3
是专用模块(谢谢您的任何可能的替代方法!),我成功安装了该模块:
c:\>pip install -U pyttsx3
Requirement already satisfied: pyttsx3 in c:\users\...\python39\site-packages (2.90)
Requirement already satisfied: comtypes in c:\users\...\python39\site-packages (from pyttsx3) (1.1.11)
Requirement already satisfied: pywin32 in c:\users\...\python39\site-packages (from pyttsx3) (304)
Requirement already satisfied: pypiwin32 in c:\users\...\python39\site-packages (from pyttsx3) (223)
但是我无法初始化引擎:当我这样做时,
>>> e = pyttsx3.init()
Traceback (most recent call last):
File "C:\Users\...\Python39\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Program Files\...\lib\weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
...
File "C:\Users\...\Python39\site-packages\pyttsx3\drivers\sapi5.py", line 10, in <module>
import pythoncom
File "C:\Users\...\Python39\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
ModuleNotFoundError: No module named 'pywintypes'
我注意到了该部分的那一部分脚本在我的用户\ ... \ AppData \ local \ packages \ pythonsoftwarefoundation ...
中,有些在中,“ c:\ program Files \ windows files \ program files \ pythonsofts \ pythonsoftwefultation ...
> 似乎适用于Python 2.7:它们产生语法错误:打印“ ...” - 您的意思是print(“ ...”)?
是否有python 3版本的 speeck> speeck> /code>或其他任何选择?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
pyttxs3有点(实际上是非常)的故障包裹。我使用了此功能。您需要安装 pygame (这是一个制作游戏包,但我们将使用它)和 gtts ie Google文本到语音
pyttxs3 is a little (actually very) glitched for example after i removed a part of my code which involved speaking something it still spoke my old code i removed the whole pyttxs3 from my code it still didn't work at last i had to uninstall the package. I used this function. You need to install pygame (it is a game making package but we will use it) and gtts i.e google text to speech
由于错误
“失败加载libmpg123-0.dll”
,Roop的答案对我没有完全解决,但它使我能够找到以下工作解决方案:(似乎是已知的错误/a>如果脚本结束得太早,声音不会播放到最后,因此我添加了睡眠(10),但显然您可以做其他事情
。 /code>和
pywin32
保持打开状态。Roop's answer didn't work out completely for me due to an error
"Failed loading libmpg123-0.dll"
, but it enabled me to find the following working solution:(It appears to be a known bug of
playsound
that the sound isn't played to the end if the script ends too early, therefore I added the sleep(10), but obviously you can do other stuff instead.)That said, the question regarding
pyttsx3
andpywin32
remains open.