Step 1 – Prerequisites
This Python installation required the GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.
Read: How to Use SSH to Connect Remote Linux Server
Step 2 – Download Python 3.7
Download Python using the following command from the Python official site. You can also download the latest version in place of specified below. Now extract the downloaded package.
Step 3 – Install Python 3.7
Use below set of commands to compile Python source code on your system using altinstall. make altinstall is used to prevent replacing the default python binary file /usr/bin/python. Now remove downloaded source archive file from your system
Step 4 – Check Python Version
Check the latest version installed of python. Use command python3.7 instead of python. The new binary will be installed at /usr/local/bin/python3.7 location: