If I open Terminal and type in python, I see the version is 2.7.4. How do I get python 3.4? And do I need IDLE if I have sublime text?
If I open Terminal and type in python, I see the version is 2.7.4. How do I get python 3.4? And do I need IDLE if I have sublime text?
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.