15

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

  • 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 2 '13 at 4: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 2 '13 at 7:21
16

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
  • 2
    How can this be an accepted answer? According to this answer there is no 3.3 version available for Wheezy. – Jim Aho Oct 13 '15 at 13:25
  • I wanted to ask if installing python3 with apt-get will also make it default or not – Pitto Dec 7 '15 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.