简体   繁体   English

在 Linux 环境中从 Python 创建 Windows 可执行文件的最简单方法

[英]Easiest way to create executable for windows from a Python on Linux environment

I want to make a Python 3.6 program which I develop on Ubuntu into an executable for windows.我想将我在 Ubuntu 上开发的 Python 3.6 程序制作成适用于 Windows 的可执行文件。 From what I searched online it seems I will need pyinstaller over wine.从我在网上搜索的内容来看,我似乎需要 pyinstaller 而不是 wine。 If there is an easier way, you can stop reading here, and suggest another way.如果有更简单的方法,您可以在此处停止阅读,并建议另一种方法。 I tried to follow the answer on Cross-compiling a Python script on Linux into a Windows executable but then I got to the part after downloading the python.我试图按照关于将 Linux 上的 Python 脚本交叉编译为 Windows 可执行文件的答案进行操作,但是在下载了 Python 之后我进入了该部分。 I downloaded the latest python version for windows which was the file python-3.7.3-amd64.exe which is not an MSI like in the answer on the link above which use python-2.7.10.msi .我下载了适用于 Windows 的最新 python 版本,该文件是python-3.7.3-amd64.exe文件,它不像上面使用python-2.7.10.msi的链接上的答案那样是 MSI。 What would be the replacement for the cmd in the link for:链接中 cmd 的替代品是什么:

wine msiexec /i python-2.7.10.msi /L*v log.txt wine msiexec /i python-2.7.10.msi /L*v log.txt

? ? Do the other steps have to change?其他步骤需要改变吗? In general, is it more recommendable to use python 2.7 to create the exe, can't my program have incompatibility issues with it (since i used python3.6 on my Linux for the development)?一般来说,使用python 2.7创建exe是否更值得推荐,我的程序不能与它有不兼容问题(因为我在Linux上使用python3.6进行开发)?

It's more recommended to use same version of python to avoid bugs.更推荐使用相同版本的python以避免错误。

Maybe check this link : https://askubuntu.com/a/1133860 Apparently installer for python3 does not work well with wine, but you can use zip available on official site.也许检查这个链接: https : //askubuntu.com/a/1133860显然 python3 的安装程序不适用于 wine,但您可以使用官方网站上提供的 zip。

For more information about python version and wine, check this link : https://appdb.winehq.org/objectManager.php?sClass=application&iId=7578有关python版本和wine的更多信息,请查看此链接: https : //appdb.winehq.org/objectManager.php?sClass=application&iId=7578

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

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