Once that is done, let’s check what are versions are now available in update alternatives. In the same way, you can set the priority to alternate versions. Update-alternatives -install /usr/bin/python python /usr/bin/python3.8 2 update-alternatives -install /usr/bin/python python /usr/bin/python2.7 1 Thus, I am setting 2.7 as the default version by giving it priority 1 and 2 to 3.8 one. For example, I have two versions on my systems, one is 2.7, and the other is 3.8. Well, to set the default one, we need to assign priority to different versions of Python language available on our Ubuntu system.įor that first set alternative versions for Python. On your command terminal of Linux, which version should call 2.7, 3.8, or any other.
As we know the latest version of Python on Ubuntu is 3.x, thus, in case you want to install that as well.Īlthough we can install multiple versions, however, the problem how to set the default one for the system.Pip2 is not available in the Ubuntu 20.04 repository to install, therefore we need to download it manually- sudo apt install curl curl -output get-pip.py You can also use the below command to install Python-2:.Sudo add-apt-repository universe sudo apt install python2.7 Let’s see how to install Python 2.7 version on Ubuntu 20.04 LTSĪs the packages to install this programming language are already on the official repository, thus simply type- sudo apt update.Python also supports various programming styles, such as imperative, structural, functional, or aspect-oriented programming. Object orientation is fully supported in Python, but no object-oriented programming is enforced. The syntax of Python is simple and understandable so that beginners and those switching can quickly find their way around.
But it’s just a piece of software like any other – installation and management can sometimes be complex. With the entry-level and user-friendly programming language Python, you can code almost any imaginable application. Here we will show you that along with steps to update-alternatives for selecting the default Python version on your Linux. If not, run the following command to install Python3. In Ubuntu 16.04 and above, Python3 is present by default. Although the latest version on Ubuntu 20.04 of Python is 3.x, however, we still can install Python 2.7 from its official repository. Open terminal and run the following command to update system packages before installing django. This is important as it increases the execution speed of your code by at least 10 percent: cd Python-3.
Extract the TGZ file that you just downloaded: tar -xvf Python-3.Download the Python source code from the official FTP server: wget https: //.Make a new directory to store the Python source files: mkdir /python & & cd /python.Install supporting dependencies on your system with APT: sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget.Update your system's local repository list: sudo apt update.Although compiling the source code might seem a bit daunting to you at first, it'll become easier once you know the process. You can also download and build the latest version of Python from the official Python website. Install Python 3 on Ubuntu From Source Code