【问题标题】:How to build python code for mac os x using cx_freeze on windows?如何在 Windows 上使用 cx_freeze 为 mac os x 构建 python 代码?
【发布时间】:2016-10-08 11:56:20
【问题描述】:

我已经安装了 cx_freeze,它的工作原理就像构建 .exe 的魅力,但我想使用 windows 7 为 mac os x 制作我的 python 程序的可执行文件。你能指导我如何使用 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")]
)

【问题讨论】:

  • 你需要 Mac OS X。尝试在 windows 7 上安装虚拟机,安装 OS X。然后你可以为这个目标操作系统构建。

标签: python windows macos cx-freeze


【解决方案1】:

安装 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/

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-11
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      相关资源
      最近更新 更多