Mac Python“安装步骤失败:运行postflight脚本”

我是Python开发的新手,在尝试获取Aptana Studio安装程序时,我似乎搞砸了我的Python安装.所以我在这里遵循了MacMac的卸载说明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中的某些内容,而不是/Library/Frameworks/Python.frameworks.或者,也许您较早时遵循了Python Wiki here上不幸的误导建议,以创建从/Library/Frameworks/Python.frameworks到系统Python框架的符号链接,这可能会导致在安装新版本的Python时无意间损坏系统Python .安装程序日志中的BOMFatalError消息是正常现象,可以忽略.同样,安装程序的修订系统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
上一篇:java-Inno设置:如何检查JRE是否存在,如果不存在,则提示下载?


下一篇:为python 2.7安装mysql