The Ubuntu operating systems from 14.X onwards all have python 3.x interpreter bundled. H
In order to check which version of python is currently configured on your Ubuntu desktop simply execute the following command in a terminal window session
If most cases this will usually return the python version 2.7 because this is usually the default interpretter Ubuntu is shipped with, However, Python3 is also packaged and can be accessed.
To check if Python3 is installed on your release of simply open a terminal window and type
you should see a response similar:
Install Python 3 if not installed on Ubuntu
If you do not have python3 installed then you can install it using:
Due to the way most Linux distributions are handling the Python 3 migration, Linux users using the system Python without creating a virtual environment first should replace the python command python3 and the pip command with pip3 –user.
For simplicity going forward, we will install
Configure python3 as default interpretter
To configure Python 3 as the default interpreter you need to configure an alias and point it to the python3 interpretter
Create a bash_aliases file, that will be used by the terminal window in future.
In your terminal window type in the following
Once this is complete we will need refresh the current terminal window with the updated information. To do so simply.
Now when you type python in your terminal window you should see the version number of 3
If you ever need to alter your python version in future.
If you would like to change it back again in the future, you can simply edit the file using
Then refresh your terminal again
PIP is a package manager for Python packages. A package contains all the files you need for a module. Modules are Python code libraries you can include in your project.
In order to ensure you use the latest version of PIP for Python3 we will also need to install it and configure it as your default package management system.
in order to do so first ensure that is is installed
We can now edit the
bash_aliases again and add
alias pip=pip3 to do so simply
Refresh your terminal
The you can test using
We simply covered how you can configure Python3 as the default python interpretter on your Ubuntu Desktop.
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.
Latest posts by Gary Woodfine (see all)
- How to install and configureAWS CLI on ubuntu - January 18, 2019
- How to start a new Python Project using Pycharm and Conda on ubuntu - January 11, 2019
- How to add Vuetify to Laravel Project - January 7, 2019