Ubuntu – How to make the terminal run python 3.1

command linepython

Currently, when I type "python" at the terminal I get v2.6 which is all fine and dandy but how can I set it to use v3.1 instead? Is there a "path" variable out there somewhere that I can change like windows?

EDIT: I already have python3 installed and up and running. I just want to know how to set it as the shells default python version.

Best Answer

Use python-virtualenv to create a virtual python environment.

Select the version of Python to be created in the virtual environment:

virtualenv --python=/usr/bin/python3.1 myvirtualenv

To manage multiple virtual Python environments, install the virtualenvwrapper extension.

Why virtualenv?

The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.4/site-packages (or whatever your platform's standard location is), it's easy to end up in a situation where you unintentionally upgrade an application that shouldn't be upgraded.

Related Question