Search code examples
pythonwindowsmacoscx-freeze

How to build python code for mac os x using cx_freeze on windows?


I have installed cx_freeze and it works like a charm to build .exe but I want to make executable file of my python program for mac os x using windows 7. Can you guide me how I can do it using cx_freeze or any other application.

I use following code to build .exe

from cx_Freeze import setup, Executable
build_exe_options = {
"packages": [],
'includes': ['lxml.etree', 'lxml._elementpath', 'gzip'],
'excludes' : ['boto.compat.sys',
              'boto.compat._sre',
              'boto.compat._json',
              'boto.compat._locale',
              'boto.compat._struct',
              'collections.abc',
              'boto.compat.array'],
"include_files": []}

setup(
    name = "xyz",
    version = "0.1",
    description = "",
    author = "Dengar",
    options = {"build_exe": build_exe_options},
    executables = [Executable("xyz.py")]
)

Solution

  • Install VirtalBox.

    Then follow this guide to install an OS X virtual machine: http://lifehacker.com/5938332/how-to-run-mac-os-x-on-any-windows-pc-using-virtualbox

    Then you will be able to install Python tooling and build your project.

    You can also find a friend who has OS X and the Python tooling…

    Here is a guide for OS X : https://pythonschool.net/pyqt/distributing-your-application-on-mac-os-x/