简体   繁体   中英

exe file created using pyinstaller in windows 10 does not run in windows 8

不幸的是,当我在 Windows 10 中创建一个 exe 文件时,它永远不会在 Windows 8 中运行。 Pyinstaller 在使用“pyinstaller.exe --onefile myfile.py”在 cmd 中运行后在我的 Windows 10 中运行的 dist 文件夹中为我提供了一个成功的 exe 文件成功但从未在 Windows 8 等早期版本中运行。

The problem is most likely that you're missing DLLs on the machine that won't run the executable.

This is due to the fact that some where, some time you've installed either a .NET environment, a Visual Runtime environment or a runtime containing a particular set of DLL's for the application to function.

You can use the --add-data argument to Add DLLs.

The pyinstaller documentation has this to say about targeting older versions of Windows:

For Python >= 3.5 targeting Windows < 10, the developer needs to take special care to include the Visual C++ run-time .dlls: Python 3.5 uses Visual Studio 2015 run-time, which has been renamed into “Universal CRT“ and has become part of Windows 10. For Windows Vista through Windows 8.1 there are Windows Update packages, which may or may not be installed in the target-system. So you have the following options:

  1. Build on Windows 7 which has been reported to work.

  2. Include one of the VCRedist packages (the redistributable package files) into your application's installer. This is Microsoft's recommended way.

  3. Install the Windows Software Development Kit (SDK) for Windows 10 and expand the .spec-file to include the required DLLs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM