PDA

View Full Version : Python 3.0



riminicat
June 13th, 2009, 08:25 PM
I decided to learn to program and would like to start with python 3.0, I have it installed on my system but when I run python in the terminal, the old version starts(because that was installed too). How can I change it so that when I type "python", 3.0 is the one it uses?

simeon87
June 13th, 2009, 08:54 PM
Type:


which python

(on my system: /usr/bin/python)

and change/replace that link by a link to python3.0. So in other words, create a link to the python3.0 executable and put it there as python.

riminicat
June 13th, 2009, 08:57 PM
Hey thanks, that was simpler than I imagined.

soltanis
June 13th, 2009, 09:18 PM
Don't change that link. You might break other programs (which are python2.x scripts not compatible with python3) that depend on older python to run.

Instead, type 'python3' to get the 3.0.1 interpreter.

simeon87
June 13th, 2009, 09:39 PM
Don't change that link. You might break other programs (which are python2.x scripts not compatible with python3) that depend on older python to run.

Instead, type 'python3' to get the 3.0.1 interpreter.

Good point.

Can+~
June 13th, 2009, 09:43 PM
python3 myscript.py

And if you want to define the typical header:


#!/usr/bin/python3

riminicat
June 13th, 2009, 09:57 PM
Hey thanks guys, I'll do that.

jayboe
April 16th, 2011, 09:00 PM
Don't change that link. You might break other programs (which are python2.x scripts not compatible with python3) that depend on older python to run.

Instead, type 'python3' to get the 3.0.1 interpreter.

When I typed python3 in the terminal it did not work for me on UE2.9(Ubuntu10.10), but when I appended the .0 (python3 now python3.0) it worked fine. Thanks for the lead :smile:

cguy
April 16th, 2011, 10:42 PM
even better: python3.1