编译PySide应用程序的最佳方法是什么 [英] What is the best approach with compiling PySide application

查看:137
本文介绍了编译PySide应用程序的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在为Linux编译pyside代码时我很痛苦,而在Windows上则更少,我的资源大约为300kb。我想知道什么是最安全的编译方法。

I have lot of pain while compiling pyside code for Linux...much less for Windows, and my source is around 300kb. I would like to know what is the safest way to compile it.


  1. 编译Qt,PySide绑定,Python 2.7,以及每个具有单独流程的导入?

1.1。如果我这样做,是否更容易跟踪错误?

1.1. If I do it this way, is it easier to trace errors?


  1. qt4-qmake是否有任何理由在

  1. Does qt4-qmake have any reason to use it while compiling?

重写PyQt而不是Pyside的代码更好吗?

Is it better to rewrite code for PyQt instead of Pyside?

是否取决于某些版本的组合,例如:( Qt v4.8.2,pyside 1.0.1,python 2.7.3)?

Are it depending about happy combination of some versions, for instance: ( Qt v4.8.2, pyside 1.0.1, python 2.7.3 ) ?

编辑:
通过编译将python脚本转换为可执行的Windows / Linux程序的方式,如py2exe,cx_Freeze或PyInstaller。

By compiling mean to convert Python scripts into executable Windows/Linux programs, as py2exe, cx_Freeze or PyInstaller do.

感谢您的建议。

推荐答案

我唯一的经验是使用cx_freeze(使用python 3.3)。它适用于Windows / Linux / OSX。
可以在此处找到一个简单的示例(及其文档): http://cx-freeze.readthedocs.org/en/latest/distutils.html#distutils

My only experience is with cx_freeze (using python 3.3). It works in Windows/Linux/OSX. A simple example can be found here (with its documentation): http://cx-freeze.readthedocs.org/en/latest/distutils.html#distutils

另一个示例:

from cx_Freeze import setup, Executable

# dependencies
build_exe_options = {
    "packages": ["os", "sys", "glob", "simplejson", "re", "atexit", "PySide.QtCore", "PySide.QtGui", "PySide.QtXml"],
    "include_files": [("./example/Ui/MainWindow.ui", "Ui/MainWindow.ui"),
                      ("./example/Ui/ExampleWidget.ui", "Ui/ExampleWidget.ui"),
                      ("./example/Ui/TestDialog.ui", "Ui/TestDialog.ui"),
                      ("./example/Resources/style.qss", "Ui/style.qss")], # this isn't necessary after all
    "excludes": ["Tkinter", "Tkconstants", "tcl"],
    "build_exe": "build",
    "icon": "./example/Resources/Icons/monitor.ico"
}

executable = [
    Executable("./bin/Example.py",
               base="Win32GUI",
               targetName="Example.exe",
               targetDir="build",
               copyDependentFiles=True)
]

setup(
    name="Example",
    version="0.1",
    description="Example", # Using the word "test" makes the exe to invoke the UAC in win7. WTH?
    author="Me",
    options={"build_exe": build_exe_options},
    executables=executable,
    requires=['PySide', 'cx_Freeze', 'simplejson']
)

这篇关于编译PySide应用程序的最佳方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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