3

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

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

This previous question:

Where is gcc on OSX? I have installed Xcode already

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

Should I just link my /Developer directory to somewhere else in /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.

Community
  • 1
  • 1
OscarRyz
  • 196,001
  • 113
  • 385
  • 569

3 Answers3

6

I was struggling with this problem all day today.

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

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"

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.

pnkfelix
  • 3,770
  • 29
  • 45
1

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

/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.

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
dhdean
  • 77
  • 2
  • Thanks, I've checked and yes, is there also. Now the question would be, how to make gcc find it. Is there a way to globally modify the *include path* ? – OscarRyz Apr 21 '10 at 21:16
  • 1
    @OscarRyz: Pass the `-I` flag to gcc: `gcc -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5` – mipadi Jul 06 '10 at 17:25
0

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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Martin Geisler
  • 72,968
  • 25
  • 171
  • 229