【问题标题】:Including distutils in a py2app bundle在 py2app 包中包含 distutils
【发布时间】:2011-05-29 14:20:11
【问题描述】:

我有一个安装 Python 的脚本,然后安装一些模块模块:

subprocess.call("python setup.py install")

它在带有 py2exe 的 Windows 上运行良好。但在 Mac 上,使用 py2app,安装附加模块时出现以下错误:

File setup.py
    from distutils.core import setup
ImportError: No module named distutils.core

我尝试在构建 .app 包时明确包含 distutils,使用 python setup.py py2app --packages distutils,但随后出现此错误:

error: invalid command 'install'

对可能出现的问题有什么想法吗?

【问题讨论】:

    标签: python macos distutils py2app


    【解决方案1】:

    尝试为 MacOS 传递 env={}。

    我发现出于某种原因,您需要 env=None 用于 Windows,而 env={} 用于 MacOS。我试图从通过 Windows 上的 py2exe 和 MacOS 上的 py2app 运行的应用程序在本地 Python 中启动 Pylint(以及通过 Linux 上的 egg install)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-09
      • 2011-11-23
      • 2012-06-07
      • 1970-01-01
      • 1970-01-01
      • 2015-03-09
      • 1970-01-01
      相关资源
      最近更新 更多