python3.x - Python用Py2exe打包脚本 找不到Win32api模块
PHPz
PHPz 2017-04-17 17:38:54
0
3
556

#这里是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函数:

PHPz
PHPz

学习是最好的投资!

Antworte allen(3)
Ty80

win32api不属于标准库,需要自己安装
https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/

洪涛

py2exe经常会有这种问题,我上次也遇到过,而且不光是win32连内置模块都找不到,后来通过安装pyinstaller解决的。

大家讲道理

对话框不需要用win32api也可以实现,而且好像编码也需要处理,用tkMessageBox会好一点。

tkMessageBox.showinfo(title,msg,parent)

还有其他的方法。

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage