[Tutor] specifying my "default" python installation

Alan Gauld alan.gauld at btinternet.com
Fri Aug 17 20:11:46 CEST 2012


On 17/08/12 15:27, debbym wrote:
> I am new to both freebsd and python.
> I have python 2.6 and 3.2 both installed on freebsd.
> "python" runs python 2.6 and I need to use "python3.2" to run python 3.2
> Do I need to do something to make python 3.2 the default?

The generic way to do that on *nix is to create/modify the symbolic 
links in the directory holding the binaries.

You should be able to get that with the which command:

which python
which python2
which python3

On my system the latest install package seems to create the 
python2/python3 links itself. I'm not sure what sets up the python link 
- the mysteries of Synaptic package management.

Once you have the directory you can view the links with ls -l
In my case its in /usr/bin so:

$ ls -l /usr/bin/pyth*
lrwxrwxrwx 1 root root       9 2011-08-13 16:04 /usr/bin/python -> python2.6
lrwxrwxrwx 1 root root       9 2011-08-13 16:04 /usr/bin/python2 -> 
python2.6
-rwxr-xr-x 1 root root 2613296 2010-04-16 15:42 /usr/bin/python2.6
lrwxrwxrwx 1 root root       9 2011-08-13 20:47 /usr/bin/python3 -> 
python3.1
-rwxr-xr-x 1 root root 2849576 2011-12-09 21:26 /usr/bin/python3.1


You can then create/modify the links as required using the ln -s command.

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list