问题
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