Switching Between Python 2.5 and 3.0 on MacOS X
I'm starting to learn the ins and outs of Python 3.0: its a fun, clean language. I really like some of the changes they've made since 2.X. However, its going to be a while before I'll be able to use Python 3.0 for large projects since its not clear when the major 3rd party frameworks (wxPython, scipy, numpy, etc.) will switch to it.
As a result, I need to keep Python 2.5.X installed on my machine and use that when I'm working on ACE and then switch to Python 3.0 when I want to have fun writing smaller-scale scripts that don't require the use of the major frameworks.
So, here's what I did.
First, I followed the instructions located here to install Python 3.0 on MacOS X Leopard. (Only, I didn't bother using MacPorts to install readline. I just installed readline myself in /usr/local by downloading the readline tarball from gnu.ftp.org.)
Those instructions install Python 3.0 here:
/Library/Frameworks/Python.framework/Versions/3.0
right where it should be.
And my Python 2.X version is installed here:
/Library/Frameworks/Python.framework/Versions/2.5
My path is set-up to include this directory:
/Library/Frameworks/Python.framework/Versions/Current/bin
with Current simply a symlink to 2.5.
So, to switch between the two versions, I created two scripts, one called make2.5 which looks like this:
#!/bin/bash
cd /Library/Frameworks/Python.framework/Versions
sudo rm Current && sudo ln -s 2.5 Current
and one called make3.0 which looks like this:
#!/bin/bash
cd /Library/Frameworks/Python.framework/Versions
sudo rm Current && sudo ln -s 3.0 Current
and now I can effortlessly switch between the two versions like so:
Jiriki:~ $ python -V
Python 3.0
Jiriki:~ $ make2.5
Password:
Jiriki:~ $ python -V
Python 2.5.2
Jiriki:~ $ make3.0
Jiriki:~ $ python -V
Python 3.0
Jiriki:~ $
Heaven! :-)
Ken
0 Comments:
Post a Comment
<< Home