致命错误:安装couchapp时找不到“Python/Python.h”文件

2024-05-02 20:47:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图从macOs High Sierra的终端安装couchapp。在

我已经安装了python2.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中执行$ ls时所得到的结果/Python.framework/

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

我目前所做的努力:

  1. 检查Xcode CL工具是否已安装运行$ xcode-select --install
  2. 尝试使用pip3而不是pip2(我已经在自制程序中安装了python3.6),但是我得到了相同的错误消息。在

你知道吗?我读过其他的帖子,但他们没有解决我的问题。在

谢谢你


Tags: 模块install文档src终端错误情况macos
1条回答
网友
1楼 · 发布于 2024-05-02 20:47:14

在安装了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 include路径中,或者在编译时通过设置-I标志作为标志:-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7。在

让我困惑的是import语句应该看起来像:#include <Python.h>而不是{},如果Python.h直接在python2.7目录中。在

希望有帮助

相关问题 更多 >