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...
$ make
$ sudo make install
$ sudo python setup.py install
$ sudo pythonw setup.py install_scripts --install-dir=/usr/local/bin
$ 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.
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):
$ 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 install
$ sudo pythonw setup.py install_scripts --install-dir=/usr/local/bin
- Get and install from the disk images on Bob's repository the following (these are required by matplotlib): python-dateutil (dmg) and pytz (dmg).
- Get and install numpy (dmg) from Bob's repository
- Get and install matplotlib (dmg) from Bob's repository
- Thank Bob (page top).
$ 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.
1 Comments:
nice post
Post a Comment
<< Home