As I am new in Python, I made a VOICE ASSISTANT by Python in Pycharm. I only write the code and run I in the pycharm, it ran smoothly. I haven't made any GUI for it. I just converted the code in the EXE file by using the Pyinstaller. when I run the exe file, it has shown me this error in Command Prompt.
Traceback (most recent call last):
File "site-packages\pyttsx3\__init__.py", line 20, in init
File "c:\users\faizan\appdata\local\programs\python\python36\lib\weakref.py", line 131, in
__getitem__
o = self.data[key]()
KeyError: 'sapi5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "s.py", line 15, in <module>
File "site-packages\pyttsx3\__init__.py", line 22, in init
File "site-packages\pyttsx3\engine.py", line 30, in __init__
File "site-packages\pyttsx3\driver.py", line 50, in __init__
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyttsx3.drivers'
[2844] Failed to execute script s
I think, this the problem of many beginners. Please Help.
Use hidden import to specify the module while creating exe,
$ pyinstaller --hidden-import=pyttsx3.drivers yourscript.py
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.