【问题标题】:Cannot find file <Python.h>找不到文件 <Python.h>
【发布时间】:2014-10-20 11:49:34
【问题描述】:

我正在使用 Xcode。我在这个新的 Mac 上遇到了一个错误: 'Python.h' file not found. 在线: #include &lt;Python.h&gt;

当我在命令行中输入sudo find / -name "Python.h" 时,我可以看到它存在很多版本,即使在 Xcode 中也是如此。

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h /System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h

有人知道发生了什么吗?是我没有正确设置 Xcode 吗?

【问题讨论】:

    标签: python c++ xcode macos python-2.7


    【解决方案1】:

    您需要设置“Python.h”所在的包含路径。

    详细操作请参考以下网址的问题“如何在xcode项目中设置包含路径”。

    How to set include path in xcode project

    【讨论】:

    • 我旧项目中的包含路径是'/urs/include/python2.7',但在我的新mac中不再存在。我在'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/找到了正确的位置python2.7/' 并添加它。谢谢。
    猜你喜欢
    • 2020-01-21
    • 2012-09-04
    • 1970-01-01
    • 2016-09-17
    • 1970-01-01
    • 2015-05-13
    • 1970-01-01
    • 1970-01-01
    • 2015-09-30
    相关资源
    最近更新 更多