Mac Python “安装步骤失败:运行postflight脚本”
我刚开始学习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
实际上,我尝试了2.5、2.6和2.7的dmg安装包,安装这三个版本时都出现了同样的错误。
我使用的是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.'.
2 个回答
你可以使用更新版本的Python来开发,只要你不使用2.5版本之后的新语法或库就可以了。(我现在用的是2.6.5。)
Python 2.7的官方支持正在准备中。
好的,根据你提到的 /usr/bin/python
出现问题(我就怕会这样!),看起来你的苹果系统自带的Python出了点问题。可能是你不小心删除了 /System/Library/Frameworks/Python.frameworks
里的某些东西,这里是苹果自带Python的存放位置,绝对不应该修改或删除,而不是 /Library/Frameworks/Python.frameworks
。或者你之前可能跟着Python wiki上不太靠谱的建议,创建了一个从 /Library/Frameworks/Python.frameworks
到系统Python框架的符号链接,这样在安装新版本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安装。一个简单但不完美的解决办法是直接创建一个从 /usr/bin/python
到python.org Python的符号链接,然后等到你重新安装Snow Leopard或升级到Lion(在升级前最好先删除那个符号链接)。所以可以这样做:
sudo bash
cd /usr/bin
mv python python-DISABLED
ln -s /usr/local/bin/python python
exit