找不到在 Mac OS X 上安装 python-dev 的方法
Can't find a way to install python-dev on Mac OS X
我正在尝试安装 psycopg2 以便与 Django 一起使用。我正在使用 virtualenv,当我尝试安装 psycopg2 时出现错误消息:
In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:30:10: error: 'Python.h' file not found with <angled> include; use "quotes" instead
#include <Python.h>
^~~~~~~~~~
"Python.h"
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:30:
psycopg/Python.h:29:10: fatal error: 'structmember.h' file not found
#include <structmember.h>
^
2 errors generated.
error: command 'clang' failed with exit status 1
我在网上发现了一些帖子似乎暗示解决这个问题的方法是安装 python-dev。不幸的是,我发现它只适用于 apt-get 和 yum。据我所知,它不适用于自制软件或 macports。谁能帮我弄清楚安装失败的原因或如何获得 psycopg2?谢谢!
编辑:我正在使用 virtualenv 并使用 postgres 应用程序。我已经安装了 XCode 命令行工具。
原来我对问题原因的理解是错误的。这不是因为我没有 Python headers,而是因为我不知何故从自制程序 python 目录中将它们全部删除了。在 Freenode 的 Python 频道聊天后,一位用户帮助我确定了问题所在。
中只有三个文件
/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7
所以我运行
brew uninstall python
brew install python
重新安装了 headers 并解决了问题!
我正在尝试安装 psycopg2 以便与 Django 一起使用。我正在使用 virtualenv,当我尝试安装 psycopg2 时出现错误消息:
In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:30:10: error: 'Python.h' file not found with <angled> include; use "quotes" instead
#include <Python.h>
^~~~~~~~~~
"Python.h"
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:30:
psycopg/Python.h:29:10: fatal error: 'structmember.h' file not found
#include <structmember.h>
^
2 errors generated.
error: command 'clang' failed with exit status 1
我在网上发现了一些帖子似乎暗示解决这个问题的方法是安装 python-dev。不幸的是,我发现它只适用于 apt-get 和 yum。据我所知,它不适用于自制软件或 macports。谁能帮我弄清楚安装失败的原因或如何获得 psycopg2?谢谢!
编辑:我正在使用 virtualenv 并使用 postgres 应用程序。我已经安装了 XCode 命令行工具。
原来我对问题原因的理解是错误的。这不是因为我没有 Python headers,而是因为我不知何故从自制程序 python 目录中将它们全部删除了。在 Freenode 的 Python 频道聊天后,一位用户帮助我确定了问题所在。
中只有三个文件/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7
所以我运行
brew uninstall python
brew install python
重新安装了 headers 并解决了问题!