简体   繁体   English

如何从 python 脚本为所有 Windows 版本构建 exe 文件,例如:Xp、7、8、10

[英]How to build exe file from python script for all Windows Version like: Xp,7,8,10

I build exe file using pyinstaller in windows 10 64bit os.我在 windows 10 64bit 操作系统中使用 pyinstaller 构建 exe 文件。 but when i test on windows7 64bit os then is not working.但是当我在 windows7 64 位操作系统上进行测试时,它无法正常工作。 that shows dll file error.显示 dll 文件错误。

so, I understated when the os is change then need to rebuilt exe file with that same system.所以,我低估了当操作系统发生变化时需要用同一个系统重建 exe 文件。 am I Right?我对吗?

pyinstaller --onefile -w --icon=pp-logo.ico WCS_Config_App.py --hiddenimport=pyserial --hiddenimport=numpy

this above way i create exe file.以上方式我创建exe文件。

So, I want to build exe file(standalone) execute for all windows system.所以,我想为所有 windows 系统构建 exe 文件(独立)执行。

Thank you for your time.感谢您的时间。

You can surelly build an app for all windows versions but compiling can be really tricky especially with big apps.The main considerations to take is:您当然可以为所有 windows 版本构建应用程序,但编译可能非常棘手,尤其是对于大型应用程序。主要考虑因素是:

  1. Python version .Not all versions of windows are capable of running all versions of python so for example since you want an XP compatibility too you will need to build your app with python3 version <= 3.4.3. Python 版本。并非所有版本的 windows 都能够运行 python 的所有版本,因此例如,由于您也想要 XP 版本 <=3.3 的兼容性,因此您需要使用 python3 构建您的应用程序。
  2. x32 or x64 must be taken as consideration, as if you build an app with x64 python will only run with x64 operating systems.必须考虑 x32 或 x64,就好像您使用 x64 构建应用程序 python 只能在 x64 操作系统上运行。
  3. DLL for windows is required(probably this is your current problem) and you will need to include the VC REDISTs required for each type of os(windows XP,7,10).You can accomplish this prety easy with an installer like inno-setup. DLL for windows 是必需的(可能这是您当前的问题),您需要包括每种类型的操作系统(Windows XP、7、10)所需的 VC REDIST。您可以使用像 inno-setup 这样的安装程序轻松完成此操作.

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

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