【发布时间】:2016-02-23 22:08:24
【问题描述】:
我正在尝试安装 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?系统一,Homebrew 安装的,还是什么?你有没有安装 Xcode 命令行工具?
-
@DanielRoseman 我在 virtualenv 中使用 Python 2.7.10。我确实安装了 Xcode 命令行工具。我在原始问题中添加了更详细的错误消息和其他一些详细信息
标签: python django pip virtualenv