Removing Python 2.4.4 on OSX
James Stroud
jstroud at mbi.ucla.edu
Sat Mar 24 16:36:21 EDT 2007
Shane Geiger wrote:
> You don't have to uninstall 2.4.4 to use 2.5. Just change where the
> symlink points:
>
> shanegeiger at shane-geigers-computer:~\ 14:45:35$ ls -la /usr/bin/python
> lrwxr-xr-x 1 root wheel 24 Mar 1 12:48 /usr/bin/python ->
> /usr/local/bin/python2.5
> shanegeiger at shane-geigers-computer:~\ 14:45:40$
>
I have been chastised on this list for a similar suggestion (notably
re-linking /usr/bin/python) as it may break the system because the
particular version installed may be required for some scripts in the system.
Probably better is to create a link in ~/bin and make sure ~/bin is
first in the path. Bash experts--please say how to do this because bash
is default for OSX and is undoubtedly what the OP is using. I use csh.
Better, even than this is to install ipython under 2.5 and put the
following script in your ~/bin (name it python):
#! /bin/csh -f
#second line of script (include above)
if ($#argv == 0) then
/usr/local/bin/ipython # <==or wherever ipython is
else
/usr/local/bin/python2.5 $argv
endif
#end of script
It doesn't matter if you use bash, the above script, though csh, will
run fine.
Now type this in a terminal: "chmod a+x ~/bin/python".
Now you can use ipython or python depending on whether you supply
arguments. ipython will launch if you supply none (which means you want
an interactive interpreter) and "regular" python2.5 will launch if you
give it a script name--avoiding jumping into the ipython interpreter
after the script finishes.
If you don't know what ipython is, you are missing out.
James
More information about the Python-list
mailing list