Take the 2-minute tour ×

I need to use nltk and numpy with Python. I am a newbie to Python and initially used the python 2.7.3 that came with my mac (currently running OSX 10.7.5). I learned that the apple version of python may not be robust so I downloaded the standard version from python.org.

I have downloaded the nltk program for Mac OSX 10.7. This seemed to install fine. I am trying to download and install numpy using the instructions from the scipy website. http://www.scipy.org/Installing_SciPy/Mac_OS_X.

I cloned numpy from github but when I tried to build it using the following command

$ python setup.py build

I received the following error

MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory

I also tried to build it using the scons command

$ python setupscons.py scons --jobs=2

and received the following error

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setupscons.py': [Errno 2] No such file or directory

Can anyone think of a possible workaround?

share|improve this question
I would download the binaries linked to by numpy rather than try to compile it yourself –  Mark Oct 27 '12 at 22:53
Or follow the instructions before they give scons as an alternative. scons is not a standard part of python or OSX e.f. the python setup.py lines –  Mark Oct 27 '12 at 23:02
Sounds like you were not in the directory where setup.py is located? –  Junuxx Oct 27 '12 at 23:13
I was working on the same thing the last few days, by the way. Do you have Xcode and its command line tools yet? MacPorts can also be useful. –  Junuxx Oct 27 '12 at 23:16

1 Answer 1

Assuming you have XCode and/or the xCode command line tools installed, you can do:

sudo easy_install pip
sudo pip install numpy
share|improve this answer
OSX does not come with a C compiler by default –  Mark Oct 27 '12 at 22:52
@Mark, which is why I said I'm not sure. Fixed the answer. –  Eudis Duran Oct 27 '12 at 22:56
I tried this. sudo easy_install pip seemed to work. The system returned the following (long) error message after I typed sudo pip install Downloading/unpacking numpy Running setup.py egg_info for package numpy Running from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg' F2PY Version 2 blas_opt_info: the err msg continues on for many par. Is numpy in the wrong directory? –  user1744871 Oct 28 '12 at 2:00
I found this answer and followed the directions. I have numpy installed! stackoverflow.com/q/10057095/1744871 Thanks to all for your help. Your comments helped me with some terminology I did not understand and inspired me to persevere. Thank you! –  user1744871 Oct 28 '12 at 3:01
Glad to hear. Sorry I did not answer your later questions, I only just recently got back online. –  Eudis Duran Oct 28 '12 at 4:45

Your Answer


