【问题标题】:fatal error: 'Python/Python.h' file not found while installing couchapp致命错误:安装 couchapp 时找不到“Python/Python.h”文件
【发布时间】:2018-09-01 10:28:18
【问题描述】:

我正在尝试从 ma​​cOs High Sierra 上的终端安装 couchapp

我安装了 python 2.7.10(默认情况下)并根据 couchapp 文档运行 $ pip2 install couchapp

这是我得到的错误:

src/watchdog_fsevents.c:22:10: fatal error: 'Python/Python.h' file not found
    #include <Python/Python.h>
             ^~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'cc' failed with exit status 1

 ----------------------------------------
  Failed building wheel for watchdog

这是我在 /System/Library/Frameworks/Python.framework/ 中执行 $ ls 时所拥有的

  • 示例
  • 模块
  • Python
  • 资源
  • 版本
  • module.map

到目前为止我所尝试的:

  1. 检查 Xcode CL 工具是否已安装运行 $ xcode-select --install
  2. 尝试使用 pip3 而不是 pip2(我已经使用 Homebrew 安装了 python 3.6),但我收到了相同的错误消息。

你有什么想法吗?我已经阅读了其他帖子,但它们并没有解决我的问题。

谢谢

【问题讨论】:

  • 这通常意味着您没有 Python 开发头文件。
  • 如果未安装,请安装 python-dev。希望有所帮助。
  • @SumitJha,没有适用于 MacOS 的 python-dev 包。相反,这些标头包含在 XCode 中。
  • 啊,是的。然后将/System/Library/Frameworks/Python.framework/Versions/2.7/include/ 添加到$PATH,也许brew reinstall python 会有所帮助。

标签: python macos couchapp


【解决方案1】:

在安装了 Xcode CLI 工具的 High Sierra (10.13.5) 设置中遇到了非常相似的问题;对我来说,Python.h 位于/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

(一些资源说可以通过find /usr/local/Cellar/ -name Python.h找到该位置,但是如果您的python没有使用brew安装,这似乎不起作用。)

将该位置添加到您的 C 包含路径中,或在编译时通过设置 -I 标志作为标志:-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

如果您的 Python.h 直接位于 python2.7 目录中,则导入语句应如下所示:#include &lt;Python.h&gt; 而不是 #include &lt;Python/Python.h&gt;

希望对你有帮助,

【讨论】:

    猜你喜欢
    • 2016-06-17
    • 2015-09-30
    • 1970-01-01
    • 2013-02-28
    • 1970-01-01
    • 2016-03-13
    • 2022-06-20
    • 2019-03-11
    • 1970-01-01
    相关资源
    最近更新 更多