4

Linux 用の pyside コードをコンパイルしている間、私は多くの苦痛を感じています... Windows の場合ははるかに少なく、私のソースは約 300kb です。コンパイルする最も安全な方法を知りたいです。

  1. Qt、PySide バインディング、Python 2.7、およびすべてのインポートを個別のプロセスでコンパイルするのが最善ですか?

1.1。このようにすると、エラーを追跡しやすくなりますか?

  1. コンパイル中に qt4-qmake を使用する理由はありますか?

  2. Pyside の代わりに PyQt のコードを書き直した方が良いですか?

  3. たとえば、いくつかのバージョンの幸せな組み合わせに依存していますか: ( Qt v4.8.2, pyside 1.0.1, python 2.7.3 ) ?

編集: py2exe、cx_Freeze、または PyInstaller が行うように、Python スクリプトを実行可能な Windows/Linux プログラムに変換する手段をコンパイルすることによって。

あなたの提案に感謝します。

4

2 に答える 2

4

私の唯一の経験は cx_freeze (python 3.3 を使用) です。Windows/Linux/OSX で動作します。簡単な例がここにあります (ドキュメント付き): 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']
)
于 2013-08-24T15:33:24.190 に答える
-2

PyPI の PySide ページにある指示に従います。

于 2013-08-23T08:26:56.617 に答える