xcode OS X 10.9 SDK 中缺少 Python.framework。为什么?另外:解决方法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19555395/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python.framework is missing from OS X 10.9 SDK. Why? Also: Workaround?
提问by Todd Ditchendorf
System:
系统:
- OS X Mavericks 10.9 13A603
- Xcode Version 5.0.1 (5A2053)
- OS X 小牛队 10.9 13A603
- Xcode 版本 5.0.1 (5A2053)
Problem:
问题:
Python.frameworkseems to be missing from Xcode's 10.9 SDK.
Xcode 的 10.9 SDK 中似乎缺少Python.framework。
Python.framework exists in the Xcode 10.8 SDK:
Python.framework 存在于 Xcode 10.8 SDK 中:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework
However, it is missing from my Xcode 10.9 SDK here:
但是,我的 Xcode 10.9 SDK 中缺少它:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/
This is odd, because Python.framework is still available to users on 10.9 systems here:
这很奇怪,因为 Python.framework 仍然可供 10.9 系统上的用户使用:
/System/Library/Frameworks/Python.framework
Has Python.framework been intentionally removed from the 10.9 SDK? Is this a not-so-subtle hint from Apple to stop using this framework? Or am I just confused?
是否有意从 10.9 SDK 中删除了 Python.framework?这是苹果公司停止使用这个框架的不那么微妙的暗示吗?还是我只是困惑?
Notes:
笔记:
This matters because I have a OS X application which links against Python.framework. It seems I cannot build my application with a Base SDKbuild setting of 10.9since Python.framework is missing, and I must link to it.
这很重要,因为我有一个链接到 Python.framework 的 OS X 应用程序。似乎我无法使用10.9的Base SDK构建设置构建我的应用程序,因为缺少 Python.framework,我必须链接到它。
I am interested in both explanations for why this framework is missing (or why I'm wrong and it's actually not missing), as well as suggestions for workarounds.
我对为什么缺少这个框架(或者为什么我错了,它实际上没有丢失)的解释以及解决方法的建议都很感兴趣。
回答by Jean Hominal
There was an official Apple support page on the subject:
有一个关于这个主题的官方 Apple 支持页面:
Changes To Embedding Python Using Xcode 5.0
Basically, what they say is that the method for integrating with Python with the SDK Python.framework
is deprecated, and the standard *nix method of using the python.h
header should be used instead.
基本上,他们说的Python.framework
是不推荐使用与Python与SDK集成的方法,而python.h
应使用标准的* nix使用标头的方法。
That is (the instructions below are a summary - please look into the linked article for more details):
即(以下说明是摘要 - 请查看链接文章了解更多详细信息):
- Replace
#include <Python/Python.h>
with#include <Python.h>
; - Include the Python header location in the header search path;
- Remove
Python.framework
from the project build; - Add the python
.dylib
file to Xcode;
- 替换
#include <Python/Python.h>
为#include <Python.h>
; - 在头搜索路径中包含 Python 头位置;
Python.framework
从项目构建中删除;- 将python
.dylib
文件添加到Xcode;
As for the rationale, they do not detail it, they simply mention that:
至于理由,他们没有详细说明,他们只是提到:
Because Python is a framework, it also resides in the SDK, even though Python (or any scripting language) has difficulties being in two places. Due to both long-term and recent issues, it was decided to remove Python from the SDK.
因为 Python 是一个框架,所以它也驻留在 SDK 中,即使 Python(或任何脚本语言)在两个地方都有困难。由于长期和最近的问题,决定从 SDK 中删除 Python。
回答by synthesizerpatel
I ran into (and solved) this problem as well:
我也遇到(并解决了)这个问题:
/bin/sh ../libtool --silent --tag=CC --mode=link gcc -I../include -I../ -g -O2 -Wall \
-isysroot <blah>/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk \
-Wl,-F/System/Library/Frameworks \
-framework Python \
-u _PyMac_Error \
-o libdnet.la -\
rpath /usr/local/lib *.lo
The things that jumped out to me initially were that the gnu libtool I was using had done the -Wl
flag append on the front of the -F
. So, I added
最初让我想到的事情是我使用的 gnu libtool 已经-Wl
在-F
. 所以,我补充说
-F/System/Library/Frameworks
-L/System/Library/Frameworks (just to be safe)
Then, the other thing that was pretty obvious was that '-framework Python' didn't have the .framework suffix like usual. So, I added that as well
然后,另一件非常明显的事情是“-framework Python”没有像往常一样的 .framework 后缀。所以,我也补充说
-framework Python.framework
I still couldn't get things to work. Then I figured out what it was:
我仍然无法让事情发挥作用。然后我想出了它是什么:
Long story short, and I don't know why it works or why they changed anything, and I'm particularly miffed that the Python.framework isn't in the SDK anymore (Granted, it was always weird linking to it, but it'll take me a while to retrain myself..
长话短说,我不知道它为什么有效或为什么他们改变了任何东西,而且我特别恼火的是 Python.framework 不再在 SDK 中(当然,链接到它总是很奇怪,但它我需要一段时间来重新训练自己..
-framework
just needs to be changed to -f
-framework
只需要改为 -f
Bonus round, there's a Python system wide settings object, as well as the 'python-config' CLI program that will need to be fixed so they don't propogate this bad setting any more.
奖励回合,有一个 Python 系统范围的设置对象,以及需要修复的“python-config”CLI 程序,以便它们不再传播这种错误的设置。
回答by Todd Ditchendorf
Looks like Python.framework has been intentionally removed by Apple:
看起来 Python.framework 已被 Apple 有意删除:
https://developer.apple.com/library/mac/releasenotes/General/APIDiffsMacOSX10_9/index.html
https://developer.apple.com/library/mac/releasenotes/General/APIDiffsMacOSX10_9/index.html
The 10.9 API diff document from Apple shows it has been removed.
Apple 的 10.9 API diff 文档显示它已被删除。
回答by germin8
The framework will become available if you install the Xcode command line tools:
如果您安装 Xcode 命令行工具,该框架将可用:
xcode-select --install