简体   繁体   English

我使用 cx_Freeze 编译了我的 python 代码,代码在它之前运行良好,现在它显示此错误有人可以帮助我吗?

[英]I complied my python code using cx_Freeze, code is working good before it & now it is showing this error can anyone help me?

I complied my code using cx_Freeze and before that code is working good in VS Code every time I try to run program they are showing error我使用 cx_Freeze 编译了我的代码,并且在每次尝试运行程序时该代码在 VS Code 中运行良好之前,它们都显示错误

this is actual error这是实际错误

---------------------------

cx_Freeze: Python error in main script
---------------------------
Traceback (most recent call last):
     File "C:\Python36\lib\site-packages\pyttsx3\__init__.py", line 20, in init
       eng = _activeEngines[driverName]
     File "C:\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 "C:\Python36\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
  module.run()
File "C:\Python36\lib\site-packages\cx_Freeze\initscripts\Console.py", line 37, in run
 exec(code, {'__name__': '__main__'})
File "ZIM.py", line 26, in <module>
File "C:\Python36\lib\site-packages\pyttsx3\__init__.py", line 22, in init
  eng = Engine(driverName, debug)
File "C:\Python36\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
  self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Python36\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
  self._module = importlib.import_module(name)
File "C:\Python36\lib\importlib\__init__.py", line 126, in import_module
  return _bootstrap._gcd_import(name[level:], package, level)
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.sapi5'

---------------------------
OK   
---------------------------

You need to manually inlcude the missing module in cx_freeze setup build_exe_options-您需要在 cx_freeze setup build_exe_options- 中手动包含缺少的模块

build_exe_options = {'packages': ['pyttsx3.drivers.sapi5']} build_exe_options = {'packages': ['pyttsx3.drivers.sapi5']}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 任何人都可以帮我解决这个列表的 python 代码,但我认为它没有工作 - Can anyone help me with my python code for this list, not working how I think it should Python cx_freeze错误 - Python cx_freeze error 为什么在尝试使用 cx_freeze 冻结我的 python 应用程序时添加其他库时会出现错误? - Why do I get an error when adding additional libraries when trying to freeze my python application using cx_freeze? 在我使用 cx_freeze 将我的游戏变成执行者后,我的源代码发生了什么变化? - What happened to my source code after I turned my game into an executive with cx_freeze? 使用cx_freeze编译Python代码后更改可执行文件名称 - Change the executable name after compiling Python code with cx_freeze 通过 cx_freeze 将 Python 代码转换为 exe 时出现问题 - Problem while converting Python code to exe via cx_freeze Python - 使用 cx_Freeze 构建二进制文件时,代码保存在哪里? - Python - When building a binary with cx_Freeze, where is the code saved? 使用cx_Freeze冻结pandas / NumPy 1.7.0代码时出错 - Error when freezing pandas/NumPy 1.7.0 code with cx_Freeze 谁能帮我在我的 python GUI 代码中找到错误? - Can anyone help me to find mistake in my python GUI code? 适用于我的python脚本的CX_Freeze —修复模块错误? - CX_Freeze for my python script — Fix up module error?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM