致命错误 LNK1181: 无法打开输入文件 'imagehlp.lib' 安装 cx_Freeze

fatal error LNK1181: cannot open input file 'imagehlp.lib' installing cx_Freeze

我正在尝试在 python 3.4 上安装 cx_Freeze 使用:

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org cx_freeze

但是,我遇到了错误

creating build\temp.win-amd64-3.4\Release\source 
C:\VS10\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG - IC:\Python34\include -IC:\Python34\include /Tcsource/util.c /Fobuild\temp.win-amd64-3.4\Release\source/util.obj 
util.c 
C:\VS10\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python34\libs /LIBPATH:C:\Python34\PCbuild\amd64 imagehlp.lib Shlwapi.lib /EXPORT:PyInit_util build\temp.win-amd64-3.4\Release\source/util.obj /OUT:build\lib.win-amd64-3.4\cx_Freeze\util.pyd /IMPLIB:build\temp.win-amd64-3.4\Release\source\util.lib     /MANIFESTFILE:build\temp.win-amd64-3.4\Release\source\util.pyd.manifest 
LINK : fatal error LNK1181: cannot open input file 'imagehlp.lib' 
error: command 'C:\VS10\VC\Bin\link.exe' failed with exit status 1181

有什么办法解决这个问题吗?

cx_Freeze的current/default版本为5.1.1,仅支持Python2.7、3.5、3.6。

支持Python3.4的cx_Freeze最新版本是5.0.2。见cx_Freezerelease notes and the cx-freeze tag info。所以你可能应该试试

pip install [...] cx_Freeze==5.0.2

其中 [...] 代表安装命令的附加选项。

我不确定这种版本不兼容是否是您报告的特定错误的根本原因,但它会在您的项目中的某个时刻引起问题。