To install the latest version of Python on Linux 2.x or 3.x, you can use the following steps:
sudo apt-get update sudo apt-get install -y build-essential checkinstallSource:www.lautturi.com
This will install the build-essential
and checkinstall
packages, which are required to build and install Python.
wget https://www.python.org/ftp/python/3.x.x/Python-3.x.x.tgz
Replace 3.x.x
with the version of Python you want to install.
tar -xvf Python-3.x.x.tgz
cd Python-3.x.x
./configure make
sudo checkinstall
This will install Python and create a package for it, so that you can easily remove it later if needed.
python3 -V
This will print the version of Python you have installed, indicating that it is working correctly.