简体   繁体   English

在Windows 8上创建的pyinstaller exe在Windows 7中不起作用

[英]pyinstaller exe created on Windows 8 does not work in Windows 7

I've made an executable file in Windows 8. It runs properly in Windows 8 and 10. The problem is when I double click the exe file in Windows 7 I get the message "myfile.exe has stopped working". 我已经在Windows 8中制作了一个可执行文件。它可以在Windows 8和10中正常运行。问题是,当我双击Windows 7中的exe文件时,出现消息“ myfile.exe已停止工作”。 I tested all things which come to my mind but the problems still remains. 我测试了所有想到的东西,但问题仍然存在。

The figure below is the message when I run my exe file 下图是我运行exe文件时的消息

The problem is most likely that you're missing DLLs on the machine that won't run the executable. 问题很可能是您在无法运行可执行文件的计算机上丢失了DLL。

This is due to the fact that some where, some time you've installed either a .NET environment, a Visual XXX environment or a runtime containing a particular set of DDL's for the application to function. 这是由于以下事实:在某些位置,一段时间内,您已经安装了.NET环境,Visual XXX环境或包含特定DDL集的运行时,以使应用程序正常运行。

From asking in the questions, it points towards a Visual C++ runtime. 从提出问题开始,它指向Visual C ++运行时。 That can be installed either via a full set of Visual C++ suit or just a VCruntime (usually) . 可以安装或者通过全套的Visual C ++的诉讼或只是一个VCruntime(通常)。

It's also important to point out that these runtimes come with their own terms of agreements and licenses. 同样重要的是要指出这些运行时带有它们自己的协议和许可条款。 That's why they aren't packed in the executable (also, usually) . 这就是为什么它们不打包在可执行文件中的原因(通常也是) You can bundle them in your executable, depending on which freeze technique you use, but it's not allowed and you need to have permission to do so. 可以将它们捆绑在可执行文件中,具体取决于您使用的冻结技术,但这是不允许的,并且您需要具有这样做的权限。

One way of doing it (via pyinstaller) is doing: 一种实现方式(通过pyinstaller)是:

pyinstaller -F --add-data ucrtbase.dll;. myscript.py

Again, check with the license if this is allowed. 再次,检查许可证是否允许。

If you against all odds decide to copy and paste the DLL with your .exe, you need to make sure it's accessible via your Windows PATH environment, seeing as that's where your executable will look for the DLLs (usually system32 or other paths) . 如果千方百计决定使用.exe复制并粘贴DLL,则需要确保可通过Windows PATH环境访问该DLL,因为这是您的可执行文件在其中寻找DLL (通常是system32或其他路径)的地方 So blindly copying it because someone on the internet said so, doesn't always work. 因此,一味地复制它是因为互联网上的某人这样说并不总是可行。 You have to learn and understand why it would work and how it works. 您必须学习并理解它为什么会工作以及如何工作。

Here's a good external source that describes this phenomena pretty well: https://docs.python-guide.org/shipping/freezing/ 这是一个很好的外部资源,很好地描述了这种现象: https : //docs.python-guide.org/shipping/freezing/

All solutions need MS Visual C++ dll to be installed on target machine, except py2app. 除py2app之外,所有解决方案都需要在目标计算机上安装MS Visual C ++ dll。 Only Pyinstaller makes self-executable exe that bundles the dll when passing --onefile to Configure.py. 只有Pyinstaller可以将--onefile传递给Configure.py时,将dll捆绑在一起的可自行执行的exe。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Windows 10 中使用 pyinstaller 创建的 exe 文件在 Windows 8 中无法运行 - exe file created using pyinstaller in windows 10 does not run in windows 8 PYINSTALLER 在 WINDOWS 上创建的 an.exe 文件可以在任何其他操作系统上运行吗? - Will an .exe file created by PYINSTALLER on WINDOWS work on any OTHER OS? 在Windows 7中使用Pyinstaller创建的exe在XP和Linux中不起作用 - Exe created with Pyinstaller in windows 7 is not working in xp and linux Will.exe 在 64 位 Python 3.7 中使用 pyinstaller 创建,在 windows 10 上工作 32 位 windows7? - Will .exe created using pyinstaller in 64 bit Python 3.7 on windows 10 work on 32 bit windows 7? 使用 pyinstaller 创建的 My.exe 文件适用于 Windows 10,但不适用于 windows 7 - My .exe file created with pyinstaller works on Windows 10, but not on windows 7 如何停止执行使用 pyinstaller (windows) 创建的 python exe 文件 - How to stop executing the python exe file created using pyinstaller (windows) Pyinstaller .exe 在 Windows 10 和 Windows 8.1 中不起作用 - Pyinstaller .exe not working in windows 10 and windows 8.1 使用 PyInstaller 创建了一个桌面应用程序,但它在 Windows 上不起作用 - Created a Desktop Application with PyInstaller but It doesn't work on Windows PyInstaller 适用于 Windows 上的 Linux,但我无法让它与 Windows 一起使用来创建 a.exe - PyInstaller works for Linux on Windows, but I can't get it to work with Windows to create a .exe 使用 PyInstaller 创建的 Python exe 在 Windows 资源管理器中显示自定义图标,但在执行时不在任务栏中 - Python exe created with PyInstaller shows custom icon in Windows Explorer but not in Taskbar when executed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM