如何使用 windows 上的 cx_freeze 为 mac os x 构建 python 代码?

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

我已经安装了 cx_freeze,它可以很好地构建 .exe,但我想为 mac os x 制作我的 python 程序的可执行文件使用 windows 7. 你能指导我如何使用 cx_freeze 或任何其他应用程序吗?

我使用以下代码构建.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")]
)

没有简单的方法。您需要在 OS X 上编译您的应用程序以包含 OS X 特定库(共享库和其他依赖项)。

您需要在 OS X 上执行此操作。

安装 VirtalBox。

然后按照本指南安装 OS X 虚拟机:http://lifehacker.com/5938332/how-to-run-mac-os-x-on-any-windows-pc-using-virtualbox

然后您将能够安装 Python 工具并构建您的项目。

你也可以找一个有 OS X 和 Python 工具的朋友…

这是 OS X 的指南:https://pythonschool.net/pyqt/distributing-your-application-on-mac-os-x/