The output should look like this: sudo update-alternatives -config python To list and choose which Python version should be active, execute the following command: sudo update-alternatives -config python Update-alternatives: using /usr/local/bin/python3.5 to provide /usr/local/bin/python (python) in auto mode Update-alternatives: using /usr/local/bin/python3.6 to provide /usr/local/bin/python (python) in auto sudo update-alternatives -install /usr/local/bin/python python /usr/local/bin/python3.5 4 Update-alternatives: renaming python link from /usr/bin/python to /usr/local/bin/python Update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python (python) in auto sudo update-alternatives -install /usr/local/bin/python python /usr/local/bin/python3.6 3 Update-alternatives: using /usr/bin/python3.10 to provide /usr/bin/python (python) in auto sudo update-alternatives -install /usr/bin/python python /usr/bin/python3.8 2 Your command line should look like this: sudo update-alternatives -install /usr/bin/python python /usr/bin/python3.10 1 ![]() Sudo update-alternatives -install /usr/local/bin/python python /usr/local/bin/python3.5 4 Sudo update-alternatives -install /usr/local/bin/python python /usr/local/bin/python3.6 3 Sudo update-alternatives -install /usr/bin/python python /usr/bin/python3.8 2 Execute the following commands one by one: sudo update-alternatives -install /usr/bin/python python /usr/bin/python3.10 1 We need to create symbolic links for every installed Python version, including the path of the installed Python version. First, you need to know that the newer Python versions installed from the default repository are located in the /usr/bin directory on the server, while the older versions built from the source are located in /usr/local/bin directory. In the last step of this tutorial, we are going to explain how you can switch between different Python versions. You should receive the following output: python3.5 -V To check the installed version, execute the command python3.5 -V. We will download and install the same way as the Python3.6 cd /opt The last version of Python in this blog post will be the Python3.5 version. You should receive the following output: python3.6 -V To check the installed version, execute the command python3.6 -V. To do that, execute the following command: cd /optīefore we proceed with installation, we need to install the prerequisites for the older Python versions: sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev libgdbm-dev libnss3-dev libedit-dev libc6-devĪfter all these preparations, we can finally build and install it with the following commands. We will need to download the build from the source. This means that Python3.6 is not in the default repository of Ubuntu 22.04. Let’s execute the following command: sudo apt install python3.6 -yĪs you noticed, the installation process failed with the following message: sudo apt install python3.6 -yĮ: Couldn't find any package by glob 'python3.6' The third Python version will be the Python 3.6 version. You should receive the following output: python3.8 -V To check the installed version, execute the command python3.8 -V. To install it, execute the following command: sudo apt install python3.8 -y The second Python version on our list will be Python 3.8. You should receive the following output: python3.10 -V To check the installed version, execute the command python3.10 -V. ![]() To install python3.10 execute the following command: sudo apt install python3.10 -y We will start with the latest version available in the default repository of Ubuntu 22.04. sudo apt update -y & sudo apt upgrade -y Step 1. ![]() User privileges: root or non-root user with sudo privilegesĮvery fresh installation of the operating system needs the packages to be updated to the latest versions available.Installing multiple Python versions on Ubuntu 22.04 is a very easy and straightforward process that may take up to 15 minutes. This tutorial will teach you about installation and changing between different versions. Also, sometimes on one Linux server, it is necessary to be installed multiple Python versions. In this blog post, we will focus on installing Python in the Linux distributions. Python is a high-level, general-purpose programming language compatible with different operating systems such as MacOS, Windows, Linux and etc. In this tutorial, we are going to explain in step-by-step detail how to install multiple Python versions on Ubuntu 22.04
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |