关于打包pywinauto程序,Module 'pythoncom' isn't in frozen sys.path错误

用pyinstaller打包pywinauto脚本为exe后,运行exe文件,出现错误,pyinstaller版本为4.8。在网上找了很久,没有找到类似的问题。想请教下前辈们,不知道能不能提供点思路,十分感谢,异常为:
Traceback (most recent call last):
File “Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py”, line 40, in
File “PyInstaller\loader\pyimod03_importers.py”, line 495, in exec_module
File “win32com_init_.py”, line 6, in
File “PyInstaller\loader\pyimod03_importers.py”, line 495, in exec_module
File “pythoncom.py”, line 4, in
File “pywintypes.py”, line 44, in import_pywin32_system_module
ImportError: Module ‘pythoncom’ isn’t in frozen sys.path [‘C:\Users\ADMINI1\AppData\Local\Temp\_MEI196282\base_library.zip’, ‘C:\Users\ADMINI1\AppData\Local\Temp\_MEI196282\lib-dynload’, ‘C:\Users\ADMINI~1\AppData\Local\Temp\_MEI196282’]

讨论数量: 4
Jason990420
  • Try Pyinstaller==4.4, or
  • Check for all 32bit or all 64bit, like your OS, Python, installed libraries.
2周前 评论
Kenny1997 (楼主) 2周前
Jason990420 (作者) 2周前

try this:

pyinstaller --hidden-import=pythoncom /path/to/yourscript.py
2周前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!