Pythonパッケージcx_Freezeツールの使用


cx_Freeze
cx_Freeze構築スクリプト
cx_Freezeは、構築スクリプト(setup.pyという名前が公式に仮定されている)に構築され、その基本フォーマットは次のとおりです.
import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "guifoo",
        version = "0.1",
        description = "My GUI application!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("guifoo.py", base=base)])

コマンドラインでコマンドを使用するには、次の手順に従います.
python setup.py build

このコマンドはsetupにあります.pyスクリプトは、setupを含むディレクトリの下にbuildフォルダを生成します.pyで指定した名前の実行可能ファイルには、他の依存ライブラリなどが含まれています.Windowsでは、以下のコマンドを使用してインストールファイル(msi)を生成できます.
python setup.py bdist_msi

Mac OS Xでは、以下のコマンドを使用して対応するdmgインストールファイルを生成できます.
python setup.py bdist_dmg

政府はいくつかの依存スクリプトの例を提供しています-Githubアドレスcx_についてFreezeでsetup.pyファイルの関連パラメータの説明は、公式ドキュメントを直接参照することができます.後続の文書では、一部の特殊な状況を補足する可能性があります.
cx_Freezeスクリプト例外の補足説明
一部の異常および対応する問題解決は、cx_を使用するリンクを参照してください.Freeze PythonスクリプトをWindows exe実戦にコンパイル