Mac OS X 上 Python 的框架和非框架构建之间的差异 [英] Differences between Framework and non-Framework builds of Python on Mac OS X

查看:40
本文介绍了Mac OS X 上 Python 的框架和非框架构建之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mac OS X 上 Python 的框架构建和非框架构建(即标准 UNIX 构建)之间有什么区别?另外,各有什么优缺点?

What are the differences between a Framework build and a non-Framework build (i.e., standard UNIX build) of Python on Mac OS X? Also, what are the advantages and disadvantages of each?

这是我在发布此问题之前找到的信息:

Here is the information that I found prior to posting this question:

  • [Pythonmac-SIG] 为什么需要 Python 的框架构建
    • B.Grainger:我似乎记得如果你想用原生 Mac GUI 做任何事情,就需要一个 Python 框架构建.我的理解正确吗?"
    • C.Barker:差不多——要访问 Mac GUI,应用程序需要位于适当的 Mac 应用程序包中.框架构建提供了这一点."
    • 框架是一个包(一个结构化目录),其中包含一个动态共享库以及相关资源,例如 nib 文件、图像文件和头文件.当您开发应用程序时,您的项目会链接到一个或多个框架.例如,iPhone 应用程序项目默认链接到 Foundation、UIKit 和 Core Graphics 框架.您的代码通过应用程序编程接口 (API) 访问框架的功能,该 API 由框架通过其头文件发布.由于库是动态共享的,因此多个应用程序可以同时访问框架代码和资源.系统根据需要将框架的代码和资源加载到内存中,并在所有应用程序之间共享资源的一份副本."
    • 相比静态链接库和其他类型的动态共享库,框架具有以下优势:
      • 框架将相关但独立的资源组合在一起.这种分组使安装、卸载和定位这些资源变得更加容易.
      • 框架可以包含比库更广泛的资源类型.例如,一个框架可以包含任何相关的头文件和文档.一个框架的多个版本可以包含在同一个包中.这使得向后兼容旧程序成为可能.
      • 无论有多少进程在使用这些资源,在任何给定时间,只有一个框架只读资源的副本物理驻留在内存中.这种资源共享减少了系统的内存占用并有助于提高性能."

      在 Mac OS X 10.6 Snow Leopard 之前,我并没有考虑太多,因为我只是下载并安装了 Python 2.6.2 Mac Installer Disk Image,这是一个框架构建,我的业务使用 virtualenv、pip 等.但是,随着 Snow Leopard 到 64 位、gcc 等的变化.,我注意到一些问题让我想自己从源代码构建/编译 Python 2.6.2+,这让我想到了将 Python 构建为 MacOSX|Darwin 框架的区别和优点/缺点.

      Prior to Mac OS X 10.6 Snow Leopard, I hadn't thought much about this, as I simply would download and install the Python 2.6.2 Mac Installer Disk Image, which is a framework build, and go about my business using virtualenv, pip, etc. However, with the changes in Snow Leopard to 64-bit, gcc, etc., I've noticed some issues that have made me want to build/compile Python 2.6.2+ myself from source, which leads me to my question of the differences and advantages/disadvantages of building Python as a MacOSX|Darwin framework.

      推荐答案

      您已经列出了制作框架的所有重要优势(恭喜您进行了出色的研究和报告!);唯一的缺点是很难安排正确构建一个,但是如果您从引用的安装程序中的示例中获取线索,它应该是可行的.

      You've already listed all important advantages of making a framework (congratulations for excellent research and reporting thereof!); the only flip side is that it's harder to arrange to build one properly, but if you take your clues from the examples in the installer you quote, it should be doable.

      BTW,Snow Leopard 自带的系统 Python 出了什么问题?我还没有从 Leopard 升级(长话短说……我确实有家庭许可证"升级 DVD,但需要 Snow Leopard 修复一些东西才能升级),所以我还没有第一手经验,但我知道它是 2.6 版本,并且有 32 位和 64 位版本……那么为什么需要构建自己的框架?

      BTW, what's wrong with the system Python that comes with Snow Leopard? I haven't upgraded from Leopard yet (long story... I do have the "family license" upgrade DVD, but need Snow Leopard to fix some things before I can upgrade), so I have no first-hand experience with that yet, but I do know it's a 2.6 build and it comes in both 32-bit and 64-bit versions... so why do you need to build your own framework?

      这篇关于Mac OS X 上 Python 的框架和非框架构建之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆