Failed to create standalone app for Mac OS X Yosemite (10.10) with cx_Freeze
I tried to create an app with cx_Freeze 4.3.1 on Mac OS X Yosemite 10.10 but it didn't work. I am using python version 2.7 and use Tkinter as my GUI for development. If I use python setup.py bdist_mac
on terminal the build process ends with an error message:
[Errno2] /Library/Frameworks/Tcl.framework/versions/8.5/TCL no such file or directory
The latest version (8.5) of Tcl / Tk is already installed.
My setup file looks like this:
from cx_Freeze import setup, Executable
build_exe_options = {
"includes": [],
"packages": [],
'excludes' : ['collections.abc', 'urllib.sys'],
"include_files": []}
setup(
name = "application",
version = "0.1",
description = "",
author = "",
options = {"build_exe": build_exe_options},
executables = [Executable("applicaton.py")]
)
Does anyone know what I can do to make it work? Thanks in advance!
source to share
I recommend that you do a few things here (hopefully a solution to two problems I can identify):
- Using Mac OS X Python system (not recommended)
- Using old and unoccupied cx_Freeze
You can fix your Python installation first! The recommended approach is to use Homebrew :
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
brew install python
You should now have a good Python installation /usr/local
that is separate from your Mac OS X Python system so you can keep things clean and separate. You also had to follow the guidelines above. This usually involves changing $PATH
:
export PATH="/usr/local/bin:$PATH"
Note. Usually you have to change your $HOME/.bashrc
or $HOME/.profile
depending on how your terminal is configured.
Now you can also have a pip
The form /usr/local/bin/pip
.
Now for a better replacement for cx_Freeze - The recommended and more supported approach these days is to use pyInstaller :
pip install pyinstaller
pyinstaller -F /path/to/my/script.py
For more complex requirements and builds please follow the pyinstaller documentation on Using sepc files
Good luck!
Note: This should fix your TCL / TK issue as well, hopefully it will!
source to share