使用pyins创建可执行文件时出错

2024-06-17 14:21:18 发布

您现在位置:Python中文网/ 问答频道 /正文

每次pyinstaller遇到错误时,我都尝试使用pyinstaller为python脚本创建一个exe,这些错误可以在pastebinhere中找到。在

同样,当我双击exe文件时,它会显示以下错误:

C:Users\Afro\AppData\Local\Temp_MEI51322\VCRUNTIME140.dll is either not designed to run on windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support. Error status 0xc000007b

然后这个:

Error loading Python DLL: C:\Users\Afro\AppData\Local\Temp_MEI51322\python35.dll(error code 193)

请问怎么了?在


Tags: orthe脚本local错误errorexeusers
3条回答

我也被类似的问题困扰着。在您的例子中,可能是UPX破坏了vcruntime140.dll。 解决方法是关闭UPX,所以只需在pyinstaller调用中添加noupx。在

pyinstaller  noupx  onedir  onefile  windowed get.py

此处的详细说明:UPX breaking vcruntime140.dll (64bit)

在我的情况下是:

pyinstaller   clean  win-private-assemblies  noupx  onedir  onefile script.py

窗口化导致wxWidgets出现问题

我也遇到过这个问题,根本原因是我使用upx压缩文件大小。解决方案是排除不应由upx压缩的文件:

pyinstaller  onefile  console  upx-dir=/path/to/upx  upx-exclude=vcruntime140.dll  upx-exclude=python36.dll my_script.py

相关问题 更多 >