如何将PyQt脚本(.py)编译为Windows(.exe)和/或linux的单独独立可执行文件? [英] How do I compile a PyQt script (.py) to a single standalone executable file for windows (.exe) and/or linux?

查看:1153
本文介绍了如何将PyQt脚本(.py)编译为Windows(.exe)和/或linux的单独独立可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用PyQt,并从pyqt白皮书示例应用程序( pastebin )创建了一个漂亮脚本)

I started to fiddle with PyQt, and made a "beautiful" script from the pyqt whitepaper example app (pastebin)

它在Windows和Linux(两者都已安装qt环境)上完美运行。

It works perfectly in Windows and Linux (with qt environment already installed on both).

问题是:因为我正在尝试使用Qt,因为它是编译的(至少纯旧的基于C ++的Qt),我如何编译一些.exe文件在Windows上运行它,或一个独立的可执行文件为Linux。

Now my question is: Since I am trying to use Qt because it is compiled (at least pure old C++ based Qt), how can I compile some .exe file to run it on Windows, or a standalone executable for Linux.

关键是我想要编译程序,因为速度和可移植性,而不是从源代码解释,这将需要在任何机器上的以前的设置。例如,目标之一是通过电子邮件向不是程序员的同事发送小的gui脚本。

The point is that I want the program to be compiled, because of speed and portability, instead of interpreted from source, which would require a previous setup on any machine. One of the goals, for example, is sending small gui scripts via email to coworkers who are not programmers at all.

推荐答案

if您希望completelly创建一个独立的可执行文件,您可以尝试这样: http://www.pyinstaller.org/。我觉得最好创建一个独立的可执行文件比cx_freeze或py2exe(在我的经验)。并易于使用(网站上提供完整的文档)。但不幸的是 PyInstaller 不支持python版本3.

if you want completelly to create one stand alone executable, you can try this : http://www.pyinstaller.org/ . i feel it's better to create one stand alone executable than cx_freeze or py2exe (in my experience). and easy to use (full documentation available in the site). But unfortunatelly PyInstaller does not support python version 3.

更新:
从@SoursopTree的最新信息现在支持python版本3.3 - 3.5。

Update: As latest information from @SoursopTree now its support python version 3.3 - 3.5.

这篇关于如何将PyQt脚本(.py)编译为Windows(.exe)和/或linux的单独独立可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆