python - Mac python "Installation step failed: run postflight script"

标签 python google-app-engine installation

我是 Python 开发的新手,在尝试获取 Aptana Studio 安装程序时,我似乎搞砸了我的 Python 安装。所以我按照此处的卸载 MacPython 说明进行操作 http://homepages.cwi.nl/~jack/macpython/uninstall.html

...现在我正在尝试再次安装 Python。

据我所知,GAE 需要您拥有 Python 2.5。所以我试图从这里安装 2.5.4 版本:http://www.python.org/download/releases/2.5.4/我已经下载了 dmg,在安装时出现以下错误:

The installation failed.

The following installation step failed: run postflight script for Fix system Python. Contact the software manufacturer for assistance

事实上,我已经为 python 尝试了 2.5、2.6 和 2.7 dmg 安装程序,并且在安装所有 3 个时我都遇到了完全相同的错误。

我正在运行 OS 10.6.8

有什么想法吗?在 Mac 上安装 Python 有更好/不同的方法吗?

更新: 当我打开我的安装程序日志时,我发现了一些问题: 我遇到了很多此类错误:

Sep 19 14:04:39 thething pkgExtractor[1689]: BomFatalError - cpio read error: bad file format
Sep 19 14:04:39 thething pkgExtractor[1689]: Package Authoring Error: Package "PythonSystemFixes-2.6.pkg" is using a deprecated archive format. Running in compatibility mode.

最后我得到了这个:

Sep 19 14:04:40 thething Installer[1641]: run postflight script for Fix system Python
Sep 19 14:04:40 thething runner[1657]: postflight[1722]: Could not find platform independent libraries <prefix>
Sep 19 14:04:40 thething runner[1657]: postflight[1722]: Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Sep 19 14:04:40 thething runner[1657]: postflight[1722]: 
Sep 19 14:04:40 thething runner[1657]: postflight[1722]: 'import site' failed; use -v for traceback
Sep 19 14:04:40 thething runner[1657]: postflight[1722]: Traceback (most recent call last):
Sep 19 14:04:40 thething runner[1657]: postflight[1722]:   File "/Volumes/Python 2.6.6/Python.mpkg/Contents/Packages/PythonSystemFixes-2.6.pkg/Contents/Resources/postflight", line 16, in <module>
Sep 19 14:04:40 thething runner[1657]: postflight[1722]:     import os
Sep 19 14:04:40 thething runner[1657]: postflight[1722]: ImportError: No module named os
Sep 19 14:04:40 thething runner[1657]: postflight[1722]: 
Sep 19 14:04:40 thething Installer[1641]: Install failed: The following installation step failed: run postflight script for Fix system Python. Contact the software manufacturer for assistance.
Sep 19 14:04:40 thething Installer[1641]: IFDInstallController 207240 state = 7
Sep 19 14:04:40 thething Installer[1641]: Displaying 'Install Failed' UI.
Sep 19 14:04:40 thething Installer[1641]: 'Install Failed' UI displayed message:'The following installation step failed: run postflight script for Fix system Python. Contact the software manufacturer for assistance.'.

最佳答案

好的,根据您关于 /usr/bin/python 失败的信息(我担心可能是这种情况!),看来您的 Apple 提供的系统 Python 存在问题。也许您错误地删除了 /System/Library/Frameworks/Python.frameworks 中的某些内容,这是 Apple 提供的 Python 所在的位置,永远不要修改或删除,而不是/Library/Frameworks/Python.frameworks。或者您可能早些时候遵循了 Python wiki 上的不幸误导建议 here创建从 /Library/Frameworks/Python.frameworks 到系统 Python 框架的符号链接(symbolic link),这可能会导致在安装新版本的 Python 时意外损坏系统 Python。安装程序日志中的BOMFatalError 消息是正常的,可以忽略。同样,安装程序的 Fix system Python 包失败本身也不是问题,因为它仅适用于 OS X 10.3。但是,它失败了,因为系统 Python 失败了,是个问题。

如果您有 Time Machine 备份或系统文件的其他备份,您可能能够正确(并且小心!)恢复 /System/Library/Python.frameworks/ 来自备份。从 Snow Leopard OS X 安装程序 DVD 中提取必要的文件很困难,但并非不可能。如果您有一台运行相同版本 OS X 的类似机器,您可能可以从那里复制文件。或者将 10.6 的 vanilla 安装到未使用的磁盘分区。一个更简单但不完美的解决方法是只创建一个从 /usr/bin/python 和 friend 到 python.org Python 的符号链接(symbolic link),然后等到你重新安装 Snow Leopard 或升级到 Lion(这可能是最安全的在升级之前删除该符号链接(symbolic link))。所以像这样:

sudo bash
cd /usr/bin
mv python python-DISABLED
ln -s /usr/local/bin/python python
exit

关于python - Mac python "Installation step failed: run postflight script",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7473762/

相关文章:

python - 在哪里添加 Pandas 的多索引级别?

python - 有没有人有 Scrapy 中 sqlite 管道的示例代码?

python - 无法使用 urlfetch 或 urllib2 从 App Engine 开发服务器连接到外部服务

python - 使用 Google App Engine 的 HTML 下拉框

python - 如何在 App Engine 中表示一对一关系

c# - Nuget: 'Google.Apis' 已具有为 'Google.Apis.Core' 定义的依赖项

c# - 无法安装 MSVS 2010 C# Express - 先决条件 x64 不安装

python - 如何在 OSX 上的单独进程中读取网络摄像头?

django - pip 找不到 pypi 项目的最新版本

python - 在Python中将图像转换为灰度