What is the best approach with compiling PySide application

后端 未结 2 1585
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 15:29

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.

相关标签:
2条回答
  • 2021-02-06 15:49

    Follow the instructions given on the PySide page on PyPI.

    0 讨论(0)
  • 2021-02-06 15:53

    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

    Another example:

    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']
    )
    
    0 讨论(0)
提交回复
热议问题