3

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...

1
  • Please edit your question and include specific details about how exactly you installed the newer python version.
    – dobey
    Nov 15, 2017 at 20:40

2 Answers 2

5

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

2
  • 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
    – hafiz031
    Jul 4, 2020 at 12:52
  • put a "sudo" before the wget command. It works!
    – Ranji Raj
    Jan 13, 2022 at 8:58
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .