search

Home  >  Q&A  >  body text

python3.x - Python用Py2exe打包脚本 找不到Win32api模块

#这里是set_up.py
from distutils.core import setup
import py2exe

py2exe_options = {"dll_excludes":['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll', 'POWRPROF.dll']}
setup(windows=['main_2.0.py'])
#py2exe的报错log
Traceback (most recent call last):
  File "main.py", line 5, in <module>
ImportError: No module named 'win32api'

导入的模块 以及唯一调用的win32api函数:

PHPzPHPz2888 days ago560

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:40:54

    win32api does not belong to the standard library and needs to be installed by yourself
    https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:40:54

    py2exe often has this kind of problem. I encountered it last time. Not only was win32 unable to find the built-in module, but it was later solved by installing pyinstaller.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:40:54

    It would be better if there is no need to use the dialog boxwin32api也可以实现,而且好像编码也需要处理,用tkMessageBox.

    tkMessageBox.showinfo(title,msg,parent)
    

    There are other ways.

    reply
    0
  • Cancelreply