How to install Python 3.4 on Ubuntu?

python 3.4 is installed on the stable release of Ubuntu 14.04. You need to use python3 to use python 3.4. For example, to execute a script file.py, use:

python3 file.py

This will use python 3.4 to interpret your program or you can use the shebang to make it executable. The first line of your program should be:

#!/usr/bin/env python3

and then use chmod +x file.py to assign executable permissions and then run your python script as ./file.py which would use python3 to execute.

If you want python3 to be used when you type python on the terminal, you can use an alias. To add a new alias, open your ~/.bash_aliases file using gedit ~/.bash_aliases and type the following:

alias python=python3

and then save and exit and type

source ~/.bash_aliases

and then you can type

python file.py

to use python3 as your default python interpreter.

No, you don't need IDLE just to use python3 to interpret your programs.


Python 3 is installed by default on modern versions of Ubuntu, so you should already have it installed:

python3 -V

To install idle 3:

sudo apt-get install idle-python3.4

I had the same issue with my ubuntu desktop. My python book told me to call python by just typing python in the terminal but it was only calling the previous python version 2.

  1. First check if you have python version 3 or not. Open command terminal, type

python3

Do you see the acknowledgment that you do? done.

  1. If you don't; install using following command line.

sudo apt-get install python3

Hope this helps!