Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I upgrade python on a Debian server?

I just created a Debian 8 cloud server and it has Python 2.7.9 installed by default, even after sudo aptitude update && sudo aptitude upgrade. How can I upgrade python (in /usr/bin/python) to 2.7.11?

I've tried:

sudo aptitude install python
sudo aptitude install python2.7

to no avail.

like image 647
YPCrumble Avatar asked Mar 29 '16 20:03

YPCrumble


2 Answers

You could also compile the latest source and install Python to an alternative path from the default (so that applications don't get messed up). Basically you would download the latest Python, configure it, compile, then install.

$> wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
$> tar xvhf Python-2.7.11.tgz
$> cd Python-2.7.11
$> ./configure
$> make
$> sudo make altinstall

Update

To see all the available options for Python configuration execute ./config --help. This is important to know because, by default, many options are left out (especially in Python 2.x) such as unicode or IPv6 support. Features can also be disabled if required.

Reference

  • Installing new version of python on Debian Linux server
  • Building Python from source on Debian or Ubuntu
like image 115
notorious.no Avatar answered Nov 15 '22 02:11

notorious.no


The latest python version in Debian 8 is 2.7.9 as you can see here: https://packages.debian.org/jessie/python . To install the latest available maybe (2.7.11-1) you can add Stretch's repos and then try to update.

# /etc/apt/sources.list :
deb http://ftp.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.debian.org/debian/ stretch main contrib non-free
like image 3
Luchezar Avatar answered Nov 15 '22 04:11

Luchezar