How do I use cx_Freeze on mac?

社会主义新天地 提交于 2019-12-20 03:29:11

问题


I used python 3.4 and cx_Freeze on my mac. I was trying to convert my python script into a stand alone application here is the code I got in my setup.py file:

application_title = "Death Dodger 1.0" 
main_python_file = "DeathDodger-1.0.py"

import sys

from cx_Freeze import setup, Executable

base = None
if sys.platform == "win32":
base = "Win32GUI"

includes = ["atexit","re"]

setup(
        name = application_title,
        version = "1.0",
        description = "Sample cx_Freeze script",
        options = {"build_exe" : {"includes" : includes }},
        executables = [Executable(main_python_file, base = base)])

I typed in these lines of code into my Terminal:

cd /Users/HarryHarlow/Desktop/Death_Dodger

and I typed in this line after:

python3.4 setup.py bdist_mac

I got this error message after long lines of other results:

error: [Errno 2] No such file or directory:       '/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl'

Please help, I've been stuck on this for 3 weeks,thank you.


回答1:


If you don't need Tcl you can exclude it in the setup file:

application_title = "Death Dodger 1.0" 
main_python_file = "DeathDodger-1.0.py"

import sys

from cx_Freeze import setup, Executable

base = None
if sys.platform == "win32":
    base = "Win32GUI"

includes = ["atexit","re"]

setup(
    name = application_title,
    version = "1.0",
    description = "Sample cx_Freeze PyQt4 script",
    options = {
        "build_exe" : {
            "includes" : includes
            "excludes": ['tcl', 'ttk', 'tkinter', 'Tkinter'], 
        }
    },
    executables = [
        Executable(main_python_file, base = base)
    ]
)

I excluded also Tkinter since as far as I can understand you are making use of PyQt4 to draw the user interface.



来源:https://stackoverflow.com/questions/31104990/how-do-i-use-cx-freeze-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!