Install Python 3 Raspberry Pi

Its pretty simple to get Python 3.2 ( the latest for Pi ) installed, just a couple of apt-get commands and a little shell hacking will do it

First lets get Python 3 install

sudo apt-get install python3

Next get setup tools

sudo apt-get install python3-setuptools

And finally we want Pip installing but ensuring it works for Python 3

sudo apt-get install python3-pip

Then modify you shell script to alias ‘python’ to run ‘python3’

alias vi='vim'
alias python='python3.2'
alias pip='pip-3.2'

The best way to do this is with your favourite editor and then adding the lines you mention, followed by using source to make them available in your current session.

sudo nano ~/.bash_aliases
source ~/.bash_aliases

Jobs a good’un !

James

Thanks for the tips, but I noticed that your second line: “sudo apt-get install python-setuptools” does not have the “3” for python, so you are downloading the 2.x version there. Works fine if you change it to:
“sudo apt-get install python3-setuptools”

And, for us less-experienced, you might point out that you change the aliases in “.bash_aliases” by using:
$ sudo nano ~/.bash_aliases
and then adding the lines you mention

If there is an update, that would be terrific. I have been searching a lot of sites for the best/most accurate way of doing this, trying to get python 3.4.3 installed and running (3.5 would be great too…).

Thanks

admin

Thanks James, I’ve updated the scripts and documentation above

As for support for Python 3.5, you just need to follow the same instructions quite literally changing .2 to .5

K

Your email address will not be published. Required fields are marked *