xcode 无法在 OSX 上构建 mercurial - 找不到 Python.h

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2686520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:17:54  来源:igfitidea点击:

Unable to build mercurial on OSX - Python.h not found

xcodemacosmercurialbuild

提问by OscarRyz

For what I've read I need Python-Dev, how do I install it on OSX?

对于我读过的内容,我需要 Python-Dev,如何在 OSX 上安装它?

I think the problem I have, is, my Xcode was not properly installed, and I don't have the paths where I should.

我认为我遇到的问题是,我的 Xcode 没有正确安装,而且我没有应该使用的路径。

This previous question:

这个上一个问题:

Where is gcc on OSX? I have installed Xcode already

OSX 上的 gcc 在哪里?我已经安装了 Xcode

Was about I couldn't find gcc, now I can't find Python.h

是关于我找不到 gcc,现在我找不到 Python.h

Should I just link my /Developer directory to somewhere else in /usr/ ???

我应该将我的 /Developer 目录链接到 /usr/ 中的其他地方吗???

This is my output:

这是我的输出:

$ sudo easy_install mercurial
Password:
Searching for mercurial
Reading http://pypi.python.org/simple/mercurial/
Reading http://www.selenic.com/mercurial
Best match: mercurial 1.5.1
Downloading http://mercurial.selenic.com/release/mercurial-1.5.1.tar.gz
Processing mercurial-1.5.1.tar.gz
Running mercurial-1.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_7RaTq/mercurial-1.5.1/egg-dist-tmp-l7JP3u
mercurial/base85.c:12:20: error: Python.h: No such file or directory
...

Thanks in advance.

提前致谢。

采纳答案by dhdean

Might depend on what version of Mac OSX you have, I have it in these spots:

可能取决于您拥有的 Mac OSX 版本,我在这些地方有:

/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h

Also I believe the version of python that comes with Xcode is a custom build that plays well with xcode but you have to jump through some hoops if you use another dev environment.

此外,我相信 Xcode 附带的 python 版本是一个自定义构建,可以很好地与 xcode 配合使用,但是如果您使用其他开发环境,则必须跳过一些障碍。

回答by pnkfelix

I was struggling with this problem all day today.

我今天整天都在为这个问题苦苦挣扎。

I eventually discovered a sitethat claimed that all one needed to do was to reinstall Xcode, or install the latest version (4.3.2, as of this writing).

我最终发现了一个网站,该网站声称只需重新安装 Xcode,或安装最新版本(撰写本文时为 4.3.2)。

So I tried that. It did not help; not on its own. But then I went a step further: I fired up Xcode.app, and once I had done that, I opened the Xcode..Preferences menu item, and then go to the Downloads tab, and say that you want to install the "Command Line Tools"

所以我试过了。它没有帮助;不是靠自己。但后来我更进一步:我启动了 Xcode.app,完成后,我打开 Xcode..Preferences 菜单项,然后转到 Downloads 选项卡,并说您要安装“Command线工具”

Once I did that, and then re-ran easy_install (in my case I was trying to "easy_install dulwich" to satisfy a hg-git dependency), it was able to properly find Python.h for me.

一旦我这样做了,然后重新运行 easy_install(在我的例子中,我试图“easy_install dulwich”以满足 hg-git 依赖),它能够为我正确找到 Python.h。

回答by Martin Geisler

Are you sure you want to build Mercurial from source? There are binary packages available, including the nice MacHgwhich comes with a bundled Mercurial.

您确定要从源代码构建 Mercurial?有可用的二进制包,包括带有捆绑的 Mercurial的漂亮的MacHg