Brownian thought space

Cognitive science, mostly, but more a sometimes structured random walk about things.

My Photo
Name:
Location: Rochester, United States

Chronically curious モ..

Tuesday, January 30, 2007

Python for MATLAB users on the Mac

I've been pretty much wanting to go and learn stuff like Perl or Python, and after a careful scouring of the net, decided upon Python, mainly for the ease with which you can use it.

But then, being such a MATLAB fan, I didn't seem right to not be able to pop a graphics window and visualize the data. So, more netsurfing later, I came up with the following way to get Python running on a Mac so it feels a bit like MATLAB.

If you do get around to trying this, make sure you're all up for taking responsibility for using sudo and the rest. Also, I've tried this on machines running Tiger; both PowerPCs and Intels, and it looked pretty ok, but ymmv. I'm certain there is a way simpler way of doing this, and if you know of one, let me know as well!
nb. Install in this order, as some things depend on others...

  • Get and install Python 2.5 for the Mac (dmg), from from this excellent repository by Bob.
  • Get and install freetype2, libpng3 (Use Fink/FinkCommander).
  • Get and compile+install zlib. To compile+install, navigate to the directory in Terminal and (the $ is the bash prompt):
$ ./configure --shared
$ make
$ sudo make install

  • Get and install this patch for Tiger.
  • Get and install wxPython (dmg) from Bob's repository.
  • Get the source for IPython from the SciPy site. To make and install, navigate to the folder from the Terminal and:
$ sudo python setup.py build
$ sudo python setup.py install
$ sudo pythonw setup.py install_scripts --install-dir=/usr/local/bin

To see if everything is OK: fire up Terminal and:
$ ipython -pylab
(On the first run you should see lots of stuff happening). The prompt changes:
In [1]: plot(sin(arange(0, 10, 0.01)))
...and you should have a nice sinewave as in this screengrab!



Next step: writing the Python-Programmer version of the Lumberjack song.

Labels: , , , , ,

1 Comments:

Anonymous website design New York City said...

nice post

January 29, 2009 12:24 PM  

Post a Comment

Links to this post:

Create a Link

<< Home