Since I last posted a “how-to” blog-post regarding the installation of
numpy
, scipy
, and pandas
, things have gotten a good bit easier, so
this is going to be a shorter post.
I’m working with a fresh install of Mountain Lion OS X, with nothing
else installed.
-
step 1: Install homebrew for mac, using the
ruby script found on its homepage:$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
-
If you follow the
homebrew
instructions at the end of the install,
you should then run$ brew doctor
and get a complaint about not having
X Code
installed. At that
point, go the App Store, download X Code. After you download X Code,
go toPreferences
and download theX Code Command Line Tools
underComponents.
At this point you should be able to run: \$brew doctor
and get the encouraging message:
your system is raring to brew!
-
Now armed with
homebrew
, and a quick glance at Homebrew & Python
Page you
can see that Python2.x
is recommended to be installed via:$ brew install python
if you’re installing
3.x
you can see replace the wordpython
withpython3
and you’re good to go. Make sure things are done this
way, that way you automatically get the install ofdistribute
and
pip
(which will be used in the next steps) -
At this point, use
brew
to install any other packages you’d like
(for instance,git
was a no-brainer along with a couple of
others). -
One package that you MUST install with
homebrew
isgfortran
,
as the scipy library depends on this. Therefore, the next step is:$ brew install gfortran
-
After that’s done, you simply need to:
$pip install numpy $pip install scipy $pip install pandas $brew install freetype #see my last post if you want to know why $pip install matplotlib
-
If you wish to test your installations, you need only
$pip install nose #needed for all tests #inside of IDLE or iPython [In:] import numpy [In:] numpy.test('full') [In:] import scipy [In:] scipy.test() #from command prompt $ nostetests pandas
And there you have it… happy key tappin’!