Python 2.5在Mac OS X 10.6上无法正确构建。 (虽然在10.5或10.4版本上它确实构建了OK ,但仍然是)。至少有一个配置修复需要从后来的Pythons进行反向移植。你需要使用gcc-4.0,而不是-4.2。一旦你已经提取来源:
cd ./Python-2.5.5/
cat >patch-configure-for-10-6.patch <<EOF
--- configure.O 2008-12-13 06:13:52.000000000 -0800
+++ configure 2010-09-29 10:16:05.000000000 -0700
@@ -2039,7 +2039,11 @@
# disables platform specific features beyond repair.
# On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
# has no effect, don't bother defining them
- FreeBSD/4.* | Darwin/[6789].*)
+ FreeBSD/4.*)
+ define_xopen_source=no;;
+ Darwin/[6789].*)
+ define_xopen_source=no;;
+ Darwin/1[0-9].*)
define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
EOF
patch < patch-configure-for-10-6.patch
export CC=/usr/bin/gcc-4.0
./configure --prefix=/usr/local --enable-framework MACOSX_DEPLOYMENT_TARGET=10.6
make
sudo make install
然后有像所需要的所有标准库模块的建立和工作如预期的第三方库各种不太明显的积累的问题 - GNU的readline和bsddb来介意 - 所以不能保证你不会遇到其他问题。
$ python2.5
Python 2.5.5 (r255:77872, Sep 29 2010, 10:23:54)
[GCC 4.0.1 (Apple Inc. build 5494)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Module readline not available.
>>>
你可以尝试使用源代码树安装程序生成脚本(在Mac/BuildScript/
),但它可能会需要修补到10.6正常工作。
即使2.5.5没有官方的python.org安装程序(它只是安全修补程序),但有一个OS X installer for 2.5.4,它在10.6上正常工作。或者使用Apple提供的2.5.4。或者试试MacPorts。在当前的Python版本上支持GAE会很好。
首先:你为什么要手动构建Python? OS X 10.6包括Python 2.5和2.6,并且有官方的OS X版本可以从http://python.org以Disk Image形式获得。 – Philipp 2010-09-29 13:27:10