Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to update the Python build on my Linux box, but the only way I know how to do it is uninstalling the current version and installing the new one. My system is already up to date (I updated yesterday). I wanted to know if there is a way to update a specific program from the command line, like sudo apt-get update <program-name>. I know this command doesn't exist, but I'm hoping something equivalent does.

share|improve this question
If your system is up to date so is the Python on your system (according to your repositories). Am I wrong? – cYrus Feb 5 '11 at 0:19
up vote 19 down vote accepted

As others already noted, bare sudo apt-get install package will install latest available version, replacing the older one if needed.

But with some software (among which is Python) the situation is somewhat different. Some major, very- and incompatibly-different versions get their own packages. For instance, Python 2.6, Python 2.7, Python 3.1 all live in separate packages on Ubuntu.

Of particular importance is the fact that one of Ubuntu policies is to extensively use Python for writing end-user software. So in fact, fairly large part of the system is written in Python. At the moment, the code runs on Python 2.6 — so this version is the default upon installation; and the code won't easily run on, say, Python 2.7 — because incompatibilities exist. To switch the system to Python 2.7 there needs to be done a piece of work, consisting of updating and re-testing all the scripts. This can't be done easily; that is, you can't just "switch" your system to Python 2.7 and delete the older version.

But. If you don't care about fancy gears of your system and just need newer Python — see no obstacles. Go and sudo apt-get install python3 and code for 3.x Python bravely; just remember to launch your scripts with python3 and use #!/usr/bin/env python3 shebang line.

share|improve this answer
Great detail about behind-the-scene workings. – efficiencyIsBliss Feb 5 '11 at 23:26
sudo apt-get install python 3.3.3

this is for python(3.3.3) for different version the corresponding version number should be used.

share|improve this answer

You're close with thinking of a command like sudo apt-get update (which is an actual command, but doesn't do what you want it to.)

To upgrade Python, and everything else you have installed, just do the command:

sudo apt-get upgrade
share|improve this answer
Thanks, but I already knew about the update command, which is why I posted the fact that my system is already up to date. I was hoping to find a command that could be targeted to specific apps. – efficiencyIsBliss Feb 4 '11 at 23:54
apt wouldn't upgrade anything up to date, so it wouldn't make a difference ;p – Journeyman Geek Feb 5 '11 at 0:15

apparently simply running apt-get install will do the trick

share|improve this answer
apt-get install python

I believe this should work. You will need to change 'python' to match the appropriate package name in your repository obviously.

share|improve this answer

In the single case that you are running a LTS version, your python might be behind by a minor version, say 2.7.5 instead of 2.7.10.

One possibility would be to upgrade the system:

  • set prompt=normal in /etc/update-manager/release-upgrades
  • upgrade the system
    • on the command line, you can type sudo do-release-upgrade to make the upgrade manager do its job to upgrade to the latest (=non-LTS) version.
    • the GUI solution uses the Update Manager

As always when upgrading, have a look at the release notes.

share|improve this answer
Dude, I tried your change and it broke my Ubuntu 14.04 system ! Basically, it tried to update from 14.04 to Ubuntu 15 and it was not able to do so successfully, leaving my system in a half way state where the graphic login no longer worked -- e.g. I would login via the graphic login and it would kick me back out to the same graphical login. Just spent the past hour+ reinstalling Ubuntu 14.04 onto my machine to fix the break your purported solution. – Gino Dec 5 '15 at 20:39
@Gino: Thank you for the feedback. Have you had a look…,… and the release notes? There is a problem with "AMD's fglrx driver". Would you like any other help? – user Dec 7 '15 at 8:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.