![](/img/trans.png)
[英]when i run my python text game i get a attribute error i dont know how to solve
[英]I have used this code for text to speech via pyttx3 and get this error I dont know how to solve it
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
錯誤:
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\Karan\AppData\Local\Programs\Python\Python38\lib\site-packages\comtypes\gen\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 1863, in <module>
ISpeechWaveFormatEx._methods_ = [
File "C:\Users\Karan\AppData\Local\Programs\Python\Python38\lib\site-packages\comtypes\__init__.py", line 329, in __setattr__
self._make_methods(value)
File "C:\Users\Karan\AppData\Local\Programs\Python\Python38\lib\site-packages\comtypes\__init__.py", line 698, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\Karan\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 125, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
只需使用降級 python 版本,如 3.8.0 或之前
pip uninstall pyttsx3
pip install pyttsx3==2.6
您可以使用“pip install pyttsx3==2.71”安裝 pyttsx3。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.