Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is Python.h in my /usr/local/python2.6 folder when my Mac is using python 2.7?

Tags:

python

I'm running a new mac with osx lion and it came with the latest Python 2.7. My /Library/Frameworks/Python.framework/Versions directory has 2.3, 2.5, 2.6, 2.7, and Current.

Now 2.5 and 2.6 have Python.h and many other header files in /include.

My problem is I can't find any header files except pyconfig.h in the 2.7/include or Current/include directories.

Can anyone shed light on this?

EDIT:

as Foo Bah pointed out, I should be looking for my header files in /usr/include. So in /usr/include I do not even have a folder python2.7. I have folders for previous version, python2.5 and python2.6.

Is there a reason that python2.7 include folder is not there even though the mac came with 2.7?

like image 972
sbartell Avatar asked Mar 16 '26 21:03

sbartell


2 Answers

OK found the answer.

You need to install a newer version of Xcode.

I had installed an older Xcode 3.2 on Lion. After upgrading, my /usr/include/python2.7 directory was populated with the header files.

like image 159
sbartell Avatar answered Mar 19 '26 10:03

sbartell


Your headers should be in /usr/include.

For example:

$ ls /usr/include/python2.*/Python.h
/usr/include/python2.5/Python.h 
/usr/include/python2.7/Python.h
/usr/include/python2.6/Python.h

None of the python distributions that come with OSX use /usr/local. If you have a separate /usr/local, you probably installed python externally

like image 45
Foo Bah Avatar answered Mar 19 '26 11:03

Foo Bah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!