15

Is there any way to update Python on the Raspberry Pi (Wheezy) to Python 3.3?

Alex Chamberlain
  • 15,530
  • 14
  • 67
  • 113
xxmbabanexx
  • 3,258
  • 7
  • 35
  • 56
  • 1
    You probably don't want to change the default. Any system software that uses Python will probably break. You could add an alias for your account. Is typing python3 instead of python really so hard? – John La Rooy Apr 02 '13 at 04:45
  • 1
    Do not change the default version unless you really need to, use virtualenv to create 'sanboxed' Python environments. You can install Python 3 into one of them without affecting any other projects that way. – phalt Apr 02 '13 at 07:21

1 Answers1

17

You can install Python 3 easily:

$ sudo apt-get install python3

However: I wouldn't recommend settting this as the default version of Python.

If you're not already, starting using virtualenv, a tool for creating 'sandboxed' Python environments. Virtualenv will let you install multiple versions of Python without them conflicting with each other.

Installation is easy:

$ sudo pip install virtualenv

and creating a virtual environment in a folder is easy too:

$ virtualenv -p /usr/bin/python3 FOLDER

The -p flag tells you which version of Python to use. Then if you go into that folder:

$ cd FOLDER

you'll notice files like so:

$ ls
bin include lib

To activate this virtualenv type:

$ . bin/activate

The terminal line with change like so:

(FOLDER)$root@raspiberrypi: $

or something similar. The(FOLDER) part at the front tells you you're using the virtualenv.

To stop using that virtualenv just type:

deactivate
phalt
  • 584
  • 4
  • 14