2010-08-20 28 views
3

我使用的是Mac OS X Snow Leopard(10.6)附带的Python 2.5。我已经设置了默认值:defaults write com.apple.versioner.python Version 2.5,通常我会得到python 2.5。在Snow Leopard上使用python 2.5构建mod_wsgi

但是,当我试图建立mod_wsgi,似乎并没有坚持。我使用--with-python=/usr/bin/python2.5选项configure强制它使用python 2.5,但构建的共享库最终引用了python 2.6库。

我也试过:

  • 设置$VERSIONER_PYTHON_VERSION 2.5建设
  • 临行前关闭--with-python

我通过讨论阅读a similar SO question。与那个人不同,我使用库存Mac OS X python,它应该可以在mod_wsgi构建过程中的框架代码中使用。


下面是一些相关命令的输出。注意末尾的otool -L的最终输出显示它正在Python 2.6框架目录中查找。

$ make distclean 
rm -rf .libs 
rm -f mod_wsgi.o mod_wsgi.la mod_wsgi.lo mod_wsgi.slo mod_wsgi.loT 
rm -f config.log config.status 
rm -rf autom4te.cache 
rm -f Makefile Makefile.in 

$ ./configure --with-python=/usr/bin/python2.5 
checking for apxs2... no 
checking for apxs... /usr/sbin/apxs 
checking Apache version... 2.2.14 
configure: creating ./config.status 
config.status: creating Makefile 

$ make 

    (compilation messages, no errors) 

$ otool -L .libs/mod_wsgi.so 
.libs/mod_wsgi.so: 
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0) 
    /System/Library/Frameworks/Python.framework/Versions/2.6/Python (compatibility version 2.6.0, current version 2.6.1) 

回答

2

尝试使用'--disable-framework'来'配置'。这将导致-L/-l被用于链接Python库而不是框架链接。这是必要的,因为不知道使框架链接使用指定为“当前”的版本以外的其他方式。

+0

完美。谢谢。 – 2010-08-21 18:07:59

+0

格雷厄姆,你之前回答我的一个问题..这是我一直在寻找的。非常感谢您的帮助,直接或间接:) – 2011-06-23 08:16:41