3

Hi i am trying to install python2.7.6 on my 16.04 cloud image. Its giving the following on - apt install python=2.7.6

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python
  • 1
    Is there any reason to not use the [default version 2.7.11](https://packages.ubuntu.com/xenial/python)? – Melebius Jun 27 '18 at 08:53
  • Possible duplicate of [How do I install a different Python version using apt-get?](https://askubuntu.com/questions/682869/how-do-i-install-a-different-python-version-using-apt-get) – wjandrea Jul 03 '18 at 01:52

1 Answers1

6

Use the following command instead:

sudo apt-get install python-minimal

This will give you the most recommended python version 2.7.12. But if you must install 2.7.6 then do the following:

wget  https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar xf Python-2.7.6.tgz
cd Python-2.7.6
./configure
make
sudo make install

You can switch between different versions using:

sudo update-alternatives --config python
Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
Dawoodjee
  • 681
  • 1
  • 7
  • 22
  • I can't see how this will help - https://packages.ubuntu.com/search?keywords=python-minimal (2.7.12) – guiverc Jun 27 '18 at 08:55