Degrading to python 3.5 from python 3.6 on ubuntu

15,272

Solution 1

Here, this should help.

Download python 3.5

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

Install required packages

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

Install python

cd Python-3.5.2
sudo ./configure
sudo make altinstall

Now check the python version python -V

Solution 2

Simplest way of installing and switching to other version of python is using pyenv.

# Get Pyenv
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

# add pyenv to ~/.bashrc
echo -e "export PATH="/root/.pyenv/bin:$PATH" \n eval "$(pyenv init -)" \n eval "$(pyenv virtualenv-init -)" " >> ~/.bashrc
source ~/.bashrc

# install python 3 via pyenv
pyenv install 3.5.6

# verify
pyenv versions

# pyenv local <version> : use this to set python version per directory.
# pyenv global <version> : use this to set python version globally.
Share:
15,272
Shubham Gupta
Author by

Shubham Gupta

Work your way out of your miseries :)

Updated on September 18, 2022

Comments

  • Shubham Gupta
    Shubham Gupta over 1 year

    I have python 3.6.3 currently on my system(ubunut 16.04). but i found that python 3.6 is not supported on ubuntu 16.04 so i want to get python 3.5 on my system.

    I installed it from here.

    Can anyone tell in detail how to do that...

    • dobey
      dobey over 6 years
      Please edit your question and include specific details about how exactly you installed the newer python version.
  • hafiz031
    hafiz031 almost 4 years
    I got permission denied in wget command. Therefore using sudo wget worked for me. I was installing python 3.7.6 btw. Reference: stackoverflow.com/a/25816730/6907424
  • Ranji Raj
    Ranji Raj over 2 years
    put a "sudo" before the wget command. It works!