繁体   English   中英

找不到在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标头,而是因为我以某种方式从homebrew 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

重新安装标头并修复问题!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM