Possible Duplicate:
How do I make the terminal run python 3.1?
I am using Ubuntu 10.10 and just installed Python 3.1 but entering python on my Gnome Terminal gets me Python 2.6 . How to fix it to get Python 3.1 on typing python on the terminal ?
Possible Duplicate:
How do I make the terminal run python 3.1?
I am using Ubuntu 10.10 and just installed Python 3.1 but entering python on my Gnome Terminal gets me Python 2.6 . How to fix it to get Python 3.1 on typing python on the terminal ?
I can't sanction Dayjay's answer at all. Replacing Python system-wide could make applications hugely unstable and in a lot of cases, they'll just break.
Python-based libraries are installed to a version-specific place (eg /usr/lib/python2.6/
) so swapping in a new version without catering for existing packages will break things that need things on the right Python path.
There are major language differences between 2.6 and 3.x that, if a package doesn't check to see what version it's using (common of older scripts) could make things unstable.
For example, if you divide two int
s in 2.6 you are returned a floored int
; but in 3.x it'll return a float
.
The safest thing to do is just call the 3.x binary when you want to use Python 3.x.
python3.1 my_python_script.py
You could simply change the symlink:
rm /usr/bin/python
ln -s /usr/bin/python3.1 /usr/bin/python
python
(for any reasons), thats exactly what it does.
– Dayjay
Apr 08 '11 at 06:09
/usr/bin/python2.6
– Oli Apr 07 '11 at 12:58