xcode5中objective-c项目嵌入python

Xcode4中在objc项目中使用Python,只需用引入Python.framework即可。
Xcode5已不能使用Python.framework了,需用通过下边的步骤添加对Python的支持。

$ python2.7-config --cflags
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE

embedding-python

把-I参数后边的路径复制到Build Settings/Header Search Paths中

$python2.7-config --ldflags
-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -ldl -framework CoreFoundation -lpython2.7

embedding-python

在Finder中打开-L参数后边的路径,把libpython2.7.dylib 拖拽到Xcode项目的Framework中,在确认框中选择链接文件而不是复制。