When py2exe comes across a DLL file that is required by the application, it decides whether or not includes the DLL file in the distribution directory using various criteria. Generally, it doesn't include DLLs if it thinks they belong to the "system" rather than the "application".
您需要重写py2exe根据哪些条件选择它包含在结果包中的DLL。下面将演示如何执行此操作
# setup.py
from distutils.core import setup
import py2exe,sys,os
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ("msvcp71.dll", "dwmapi.dll"):
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
我不确定py2exe,但cx_Freeze是一个类似的工具,正在积极更新。您可能需要使用
bin-includes
选项来列出依赖项,但默认情况下,它会创建一个包含依赖项的.exe
文件。在您需要重写py2exe根据哪些条件选择它包含在结果包中的DLL。下面将演示如何执行此操作
这段代码和上面的引文来自py2exe网站上的a page。请务必阅读该页,包括免责声明。在
相关问题 更多 >
编程相关推荐