简体   繁体   English

部署python可执行文件-PyInstaller,cx-freeze等

[英]Deploying python executables- PyInstaller, cx-freeze, etc

I'm looking to find a way to bundle a python app into stand-alone executables so my windows and mac using friends can use it without installing ugly dependencies. 我正在寻找一种将python应用程序捆绑到独立可执行文件中的方法,以便使用朋友的Windows和Mac可以使用它而无需安装难看的依赖项。 Looking online I've found a few utilities to help do this, including py2exe for windows and py2app for mac, as well as PyInstaller, cx-freeze, and bbfreeze. 在线查找时,我发现了一些实用程序可以帮助完成此任务,包括Windows的py2exe和Mac的py2app以及PyInstaller,cx-freeze和bbfreeze。 What have ya'll used and what would you recommend? 您会使用什么?您会推荐什么?

I've been building a python app with PyQt and PyQwt for the past few weeks and have had the same problem. 在过去的几周中,我一直在使用PyQt和PyQwt构建python应用程序,并且遇到了同样的问题。 I found py2app completely impossible to use, I kept running into so many problems constantly that I gave up. 我发现py2app完全无法使用,我不断遇到很多问题,以至于我放弃了。 A few days later found PyInstaller which is fantastic. 几天后发现PyInstaller很棒。 It understands both PyQt and PyQwt out of the box - and does a very nice job in wrapping everything into an app bundle. 它开箱即用地了解PyQt和PyQwt-并且在将所有内容包装到应用程序包中做得非常好。 Haven't tried building a Windows executable with it yet though. 尚未尝试使用它构建Windows可执行文件。

I found a good article at arstechnica on how to use py2exe and py2app although it's a bit old (you can probably skip the python 2.5 stuff) http://arstechnica.com/open-source/guides/2009/03/how-to-deploying-pyqt-applications-on-windows-and-mac-os-x.ars/ 我在arstechnica上找到了一篇有关如何使用py2exe和py2app的好文章,尽管它有些陈旧(您可能会跳过python 2.5的东西) http://arstechnica.com/open-source/guides/2009/03/how-to在Windows和Mac OS X上部署pyqt应用程序/

I would highly recommend using PyInstaller. 我强烈建议使用PyInstaller。 There are a couple of tricks though you need to do for OS X since the support is currently only preminary http://diotavelli.net/PyQtWiki/PyInstallerOnMacOSX 尽管您需要为OS X做一些技巧,因为目前支持仅是初步的http://diotavelli.net/PyQtWiki/PyInstallerOnMacOSX

I use py2exe to create a windows executable. 我使用py2exe创建Windows可执行文件。 The documentation is somewhat messy, but once I pulled together a working setup.py to use as a template I haven't had any problems altering it to generate any given exe. 该文档有些混乱,但是一旦我整理了一个可工作的setup.py用作模板,就可以毫无疑问地对其进行更改以生成任何给定的exe。 I've usually been able to find helpful information though Google searches, like when I needed to bundle in pngs for the UI to use. 通常,我可以通过Google搜索找到有用的信息,例如需要捆绑png以便用户界面使用时。

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

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