Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default Python version from 2.4 to 2.6

I'm wanting to use some newer software that requires Python 2.6, and we currently have both 2.4 and 2.6 installed on our dedicated CentOS server, which looks like this:

$ which python /usr/local/bin/python $ which python2.6 /usr/bin/python2.6 $ which python2.4 /usr/local/bin/python2.4 $ ls -l /usr/local/bin/py* -rwxr-xr-x 1 root root      81 Aug  9  2007 /usr/local/bin/pydoc -rwxr-xr-x 2 root root 3394082 Aug  9  2007 /usr/local/bin/python -rwxr-xr-x 2 root root 3394082 Aug  9  2007 /usr/local/bin/python2.4 

How can I switch it to start using 2.6 as the default python?

like image 790
Kristopher Ives Avatar asked Jul 26 '10 22:07

Kristopher Ives


People also ask

How do I set Python2 to default in Windows?

From here navigate to the Advanced Tab -> Click on Environment Variables. You will see a top half for the user variables and the bottom half for System variables. Check the System Variables and double-click on the Path (to edit the Path). Check for the path of Python(which you wish to run i.e. Python 2.


1 Answers

As root:

ln -sf /usr/bin/python2.6 /usr/local/bin/python 

This will make a symbolic link from /usr/local/bin/python --> /usr/bin/python2.6 (replacing the old hardlink).

like image 79
unutbu Avatar answered Oct 10 '22 05:10

unutbu