在OS X 10.6上编译Python 2.5.5 [英] Compile Python 2.5.5 on OS X 10.6

查看:84
本文介绍了在OS X 10.6上编译Python 2.5.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装Python 2.5.5以便与Google应用一起使用,但是一直很难找到有关如何执行操作的说明.我认为以下内容可能有用,但想知道是否有人成功构建了它?

I would like to install Python 2.5.5 to use with Google apps but have been having a very hard time tracking down instructions on how to do so. I am thinking the following might work but was wondering if anyone had successfully built it?

./configure --prefix=/usr/local/python2.5.5 MACOSX_DEPLOYMENT_TARGET=10.6 --enable-framework --with-universal-archs="64-bit" CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64"

~: make -j6

~: sudo make install

感谢您的帮助!

推荐答案

在Mac OS X 10.6上,Python 2.5无法正确构建. (不过,它确实在10.5或10.4上按原样构建了 .)至少有一个配置修补程序需要从更高版本的Python向后移植.而且您需要使用gcc-4.0,而不是-4.2.提取源代码后:

Python 2.5 does not build correctly out of the box on Mac OS X 10.6. (It does build OK as is on 10.5 or 10.4, though.) There is at least one configure fix that needs to be backported from later Pythons. And you need to use gcc-4.0, not -4.2. Once you have extracted the source:

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-因此无法保证您会成功.不会遇到其他问题.

Then there are various less obvious build issues like third-party libraries that are needed for all of the standard library modules to build and work as expected - GNU readline and bsddb come to mind - so there is no guarantee that you won't run into other problems.

$ 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上正常工作.

You could try using the installer build script in the source tree (in Mac/BuildScript/) but it will likely need to be patched to work correctly on 10.6.

即使没有用于2.5.5的官方python.org安装程序(仅具有安全修复程序),也有一个

Even though there is no official python.org installer for 2.5.5 (which just has security fixes), there is an OS X installer for 2.5.4 which works fine on 10.6. Or use the Apple-supplied 2.5.4. Or try MacPorts. It will be nice when GAE is supported on current Python versions.

这篇关于在OS X 10.6上编译Python 2.5.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆