Change default Python version



I found both Python 2.4 and 2.5 are installed.

python -V
shows that 2.4 is the default.
However, I want to use 2.5 as default.

[exodus]$ ls -al /usr/bin/python
lrwxrwxrwx 1 root root 9 2008-06-05 10:12 /usr/bin/python -> python2.4

A symlink is used to point Python to /usr/bin/python2.4
I can’t change the symlink with
ln -f -s /usr/bin/python2.5 /usr/bin/python
as I don’t have sudo permissions.

How can I change the default Python version for my site?



Well you can’t make a symlink as root.

It’s not “easier” to change your scripts? #!/usr/bin/python2.5

Or maybe use a symlink on your own home bin dir and change your scripts to


Maybe it’s not what you need…

Somewhere, something incredible is waiting to be known.


I plan to work on an app I retrieve with Subversion or Mercurial.
Having to change all gazillion .py files is a pita (although that could be scripted), but implies that all source files are changed.
Merging them back to the project repository means that all fiels are merged back (as all are changed), and that fellow developers suddenly have another hash bang.
I won’t make friends :wink:


bummer… I haven’t think on a distributed project… Mhhh… the only suggestion there is to install your own version of python, I think if you can write a script to change the #!/usr/bin/python even when I don’t use Mercurial, well maybe you can write another script to hook up on svn to restore the path on pre-commit hook… unfortunately this could be more hassle check… who knows maybe if you send a support ticket they can help (for the record in the server I am the versions of python installed are only 2.2,2.3 and 2.4)

On a second reading I think you can run a script to adapt your project files to DH on check out or update and before doing a commit you can run another script to restore the python path… which is far from perfect… but better than get a bunch of angry devs.

Somewhere, something incredible is waiting to be known.


Have you tried adding alias python=’/usr/bin/python2.5’ to .bash.rc and .bash_profile ?

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


That seems to do the trick :slight_smile: