IPython with Python version 2.6 on OS X Leopard
Jun 5th, 2009 by James Murty
I recently installed the excellent IPython program, a beefed-up Python console that provides a raft of extra features over the default interpreter and makes it even more of a pleasure to work with this language.
When you install IPython on Mac OS X Leopard using the standard method, it only installs against the system’s default version of Python: 2.5.1. However, since I had previously installed Python version 2.6.1 on my system I wanted IPython to work with this newer release.
It was surprisingly difficult to find out how to achieve this, so in case anyone else wishes to do the same here’s the process that worked for me. Download the IPython tarball from the distributions directory (e.g. ipython-0.9.1.tar.gz), extract the archive, change into the extracted directory and run:
Notice that the command explicitly invokes the 2.6 version of python with the
alias: this simple step is enough to properly link your IPython installation with the newer Python. It is obvious in hindsight that this would work, but I wasted enough time pointlessly messing with environment variables and paths that I thought it was worth a blog post.
Don’t try this with the bleeding-edge Python 3K because IPython is not yet compatible with this version, but it seems to work fine with 2.6.1.
Thanks James. I’ve tried all sorts of hacks and could not accomplish this – good to see someone has figured it out. Now my question is: if I already have iPython working on OSX Leopard’s default install of Python, can I just install it again?
Yes, I just re-installed IPython with the command in the post and it worked out fine. The original IPython will be overwritten though — I’m not sure if there’s a way to have both the Python 2.5 and 2.6 versions installed.
strange…I followed the post, and ipython installed just fine into the framework install of python 2.6 (I can see the files being copied into the right place). However, when I run iPython, it shows the interpreter it’s using is good old 2.5 again.
I could have sworn I had this working before.
Have you tried re-installing IPython with the 2.6 method?
Alternately, you could try editing the ipython executable file which is in /usr/local/bin (on my system anyway). This executable is just a python script that runs the IPython interpreter, and it includes the full python version path as the first line. Here is the path at the top of my version:
#!/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
I tried several solutions to change the python version in ipython without success, but this works perfectly!
Also, if you need several versions have a look at:
http://ipython.scipy.org/moin/FAQ#head-c23150d7cc12378683737626b1c7ac4986d3a853
Hi!
One simple trick:
sudo cp /usr/bin/ipython2.5 /usr/bin/ipython2.6
alias ip6=’/usr/bin/ipython2.6′
I’m not sure how copying the ipython2.5 binary to a name containing “2.6″ would help?
In any event, my iPython installation doesn’t include the ipython2.5 script so this wouldn’t have worked for me.