How to remove python and Install Python 3.5.2 on Ubuntu

When install Ubuntu package of Python come with some time your required will be deferent version for what you are looking for, this tutorial will guide you throw how to Remove existing python version and install python 3.5.2 on Ubuntu 16.04

·        How to remove python from Ubuntu

o   Uninstall python

To remove just python package itself from Ubuntu 16.04 (Xenial Xerus) execute on terminal:

sudo apt-get remove python

o   Uninstall python and it’s dependent packages

To remove the python package and any other dependant package which are no longer needed from Ubuntu Xenial.

sudo apt-get remove --auto-remove python

o   Purging python

If you also want to delete configuration and/or data files of python from Ubuntu Xenial then this will work:

sudo apt-get purge python

To delete configuration and/or data files of python and it’s dependencies from Ubuntu Xenial then execute:

sudo apt-get purge --auto-remove python

·        How to Install Python 3.5.2 on Ubuntu

o   Install Required Packages

Use the following command to install prerequisites for Python before installing it.

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

o   Download Python 3.5.2

Download Python using following command from python official site. You can also download latest version in place of specified below.

cd /usr/src
sudo wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

Now extract the downloaded package.

sudo tar xzf Python-3.5.2.tgz

o   Compile Python Source

cd Python-3.5.2
sudo ./configure
sudo make altinstall

o   Check the Python Version

Check the latest version installed of python using below command

python3.5 -V

Related Articles

Leave a Reply

Back to top button