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

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

6 Answers 6

up vote 18 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

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

apparently simply running apt-get install will do the trick

share|improve this answer
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

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
  • type sudo do-release-upgrade to make the upgrade manager do its job to upgrade to the latest (=non-LTS) version.
share|improve this answer

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.