I tried to build an application with cx_Freeze 4.3.1 on Mac OS X Yosemite 10.10 but it didn't worked. I use python version 2.7 and use Tkinter as my GUI for development. If I use python setup.py bdist_mac
on the terminal, the build process fail with the following error message:
[Errno2]/Library/Frameworks/Tcl.framework/versions/8.5/TCL no such file or directory
The newest 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 get it working? Thanks in advance!
I recommend you do a few things here (hopefully solving two issues I can identify):
First let's fix your Python installation! 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
Now you should have a good installation of Python in /usr/local
that's separate from your Mac OS X system Python so you can keep things clean and separate. You should also have followed any recommended instructions from the above installation. Typically this involves modifying your $PATH
:
export PATH="/usr/local/bin:$PATH"
Note: Normally you should modify your $HOME/.bashrc
or $HOME/.profile
depending on how you have your Terminal configured.
You should now also have pip
form /usr/local/bin/pip
available as well.
Now on to a better replacement for cx_freeze -- The recommended and more maintained 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 pyinstaller's documentation on Using sepc files
Good luck!
Note: This should also fix your TCL/TK problem as well hopefully!