Skip to content Skip to sidebar Skip to footer

How To Upgrade To Python 3.3?

I just installed Ubuntu 12.04 and wish to use Python 3.3 rather than 2.7 which is currently installed. I downloaded python from python's ftp and installed it. I followed the steps

Solution 1:

Instead of using python in terminal use python3.3


Solution 2:

Python 3.x and 2.x are incompatible languages.

PEP 394 — The "python" Command on Unix-Like Systems contains recommendations for how to handle this fact. The short version is this:

  • python should refer to the latest Python 2.x.
  • python3 should always refer to the latest Python 3.x.
  • python2 should refer to the latest Python 2.x (and must if python refers to 3.x), but often doesn't.
  • pythonX.Y should always refer to Python X.Y.

So, running python3 or python3.3 should run your custom 3.3 installation, but python should run your platform's standard 2.7.

The Rationale and Migration Notes sections explain why the first rule is as it is, but the short version is this: There are millions of scripts out there—some integral to the functional of various OS distros or third-party packages—that assume /usr/bin/env python runs Python 2.x, and no scripts that assume it runs Python 3.x.

So, your best bet is to leave things the way your distro wanted, and explicitly use python3 to refer to your 3.3 installation. (And, likewise, pip3, ipython3, idle3, etc.)


The specific instructions you followed also create a link named py. This is definitely non-standard, but I can see how it would be convenient. If you want to do this, go for it—then, instead of running python, just run py.

(However, you still want to make sure you get links named python3.3 and python3 onto the path, so you have a PEP-394-compliant installation. If those instructions don't do that for you, do it manually after you're done.)


Post a Comment for "How To Upgrade To Python 3.3?"