简体   繁体   中英

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")]
)

There is no simple way. You need to compile your app on OS X to include the OS X specific libraries (the shared libraries and other dependencies).

You need to do this on OS X.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM