The Ubuntu 14.04 LTS, Trusty Tahr, release has python 3.4 interpreter bundled , however python 2.7.6 interpreter is still the default interpreter if you access the REPL using the terminal window. In this post we will provide details on how to configure python 3.4 as the default on Ubuntu 14.04 when using the REPL in the terminal window.
Although python 3.4 is stable enough to use on Ubuntu 14.04 there are a few libraries that are not available at the time of writing (9 May 2014), most notably is the ensurepip module , a number of linux distributions (fedora, debian etc) are also wrestling with support of pip and have also omitted support for the module at present.
The ensurepip module provides support for bootstrapping the pip installer into an existing python installation or virtual environment, realistically the majority of python developers could probably live without the support for this library for the time being.
It is possible to configure Python 3.4 as default interpreter for the ubuntu 14.04, when using Python in the terminal window. To configure Python 3.4 as the default interpreter you need to configure an alias, the following steps details this. a new alias for Python follow these steps:
Open the your Terminal window (Ctrl + Alt + T)
Type in python
Exit the command line ([key]Ctrl[/key] + [key]D[/key])
We now need to create a bash_aliases file, that will be used by the terminal window in future. In your terminal window type in the following
sudo gedit ~/.bash_aliases
This will open a text file for you to edit, in the text file type in
Save and Exit the text file. Then type the following into the terminal window
Now when you type python in your terminal window you should see
If you ever need to alter your your python version in future, you just need to edit your bash_aliases file again to point to python2 .
A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.