在 Mac OS X 10.6 上重新安装 Python 2.6
很久以前,我删除了包含内置 Mac OS X Python 安装的 2.6 目录,现在我需要将其恢复。如何重新编译 Python 并将其安装到原始位置?
诸如 Fink、brew 和 MacPorts 都是我所知道的的,但如果他们能够解决我的问题,我不知道如何以这种方式使用它们。我需要将安装安装在原始位置(/System/Library/Frameworks/Python.framework/Versions
)并像原来一样工作。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的解决方案是在现有安装上重新安装 OS X 10.6。正如评论中所指出的,构建 Apple 提供的 Python 系统的精确副本是不切实际的,因为有大量的 Apple tweeks,尽管其中许多是由 Apple 此处(您可以深入了解特定的 OS X 版本,并找到其中包含的开源组件以及 Apple 提供的补丁)。但 OS X 安装程序可以轻松且万无一失地重新安装所有 OS X,而不会影响主目录中的文件或大多数记录的自定义项。如果您对
/System/Library
或/usr
(/usr/local
除外)中的文件进行了其他更改或删除,那么一切都将失败。 >);正如您所了解到的,不要这样做!与往常一样,在开始之前对硬盘进行完整备份是明智的做法。重新安装不会超过几个小时,这比尝试从源代码重新创建系统 Python 要少得多。The simplest solution is to reinstall OS X 10.6 over your existing installation. As noted in the comments, it's not practical to build an exact duplicate of the Apple-supplied system Python because of the numerous Apple tweeks although many of them are published by Apple here (you can drill down to a particular OS X release and find the open source components that went into it along with the Apple-supplied patches). But the OS X installer makes it easy and generally foolproof to reinstall all of OS X without affecting files in your home directories or most documented customizations. All bets are off if you've made other changes or deletions to files in
/System/Library
or/usr
(other than/usr/local
); as you've learned, don't do that! As always, it is prudent to do a full backup of your hard drive before you begin. A reinstall shouldn't take more than a couple of hours which will be a lot less time than trying to recreate the system Python from source.