Since Ubuntu 10.04 is an LTS release will it support python 2.7 as a default package maintainer version or at least have a python2.7 package in future?

Since it will be the last major python 2.x release and is intended to remain in place for a long time, I decided to use it. I compiled it from source (After building deps of course) but now and then I find small problems.

Is it safe to define my compiled python 2.7 as the default, as there are some distribution applications that work on python.


5 Answers 5


Had the same problem with a VPS that can't be upgraded to Maverick (even the new LTS images aren't always made available on time). Marius' answer did the trick to get me started, but it should be expanded upon:

Add the PPA to your sources

If you're in my situation, the simple advice of running add-apt-repository won't work for you. So let's do this the old-fashioned way:

  1. Open the file /etc/apt/sources.list (you need root privileges; if you're on the shell, this probably means running sudo vim /etc/apt/sources.list).

  2. Go all the way to the bottom of the file (if using vim, switch to insert mode by pressing i) and add the following lines:

    deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main 
    deb-src http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main 
  3. Save and exit (in vim: type :wq) and go back to a shell.

  4. Enter the following (you can find the correct key at the PPA; it's the part after the slash in the "technical details" -- make sure you got the right one):

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C
  5. Now enter the following to update your source list:

    sudo apt-get update

Install and set up Python 2.7

  1. Open up a shell on your server and enter the following:

    sudo apt-get install python2.7 python2.7-dev
  2. To get easy_install working, get the distribute bootscrap script:

    curl -O http://python-distribute.org/distribute_setup.py
    python2.7 distribute_setup.py
  3. Finally, you want pip and virtualenv working if you plan to do anything serious:

    easy_install-2.7 pip
    pip-2.7 install virtualenv

Setting up a virtualenv

  1. Create the folder for your new environment and open it:

    mkdir my_env && cd my_env
  2. Create the virtual environment itself (the dot indicates the current directory is the location of the environment, replace it with the correct path if you skipped the previous step):

    virtualenv --no-site-packages --python=python2.7 .
  3. Activate the environment. You'll notice the shell prompt changes to reflect the active environment:

    source bin/activate
  4. Whatever you do in this shell now will use the scripts in the virtual environment's bin folder and that environment's Python packages. Keep in mind the option --no-site-packages means you're starting with the minimal set of packages (including pip, however), so you need to install all packages you'll need.

  5. When you're done, deactivate the environment (this is a command recognized by the active environment):


You can also install packages into the virtual environment by passing the -E option to pip (e.g. pip install some-package -E /path/to/virtual/environment to install some-package to the virtual environment on the given path). Keep in mind you'll have several different versions of pip corresponding to the different Python versions installed.

It's a good idea to use pip-2.7 if you want to install packages for Python 2.7 when working outside a virtual environment (the --python=python2.7 option we passed to virtualenv means the virtual environment will use the Python 2.7 versions of the tools it provides, so you don't have to worry about that).

  • 1
    In my case I had already installed pip for 2.6, and I had to easy_install-2.7 -U pip to force the install of the 2.7 version. But thanks, this is a great help! Sep 27, 2012 at 0:41
  • 2
    For step 2 under "Install and set up Python 2.7" I had to do wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | sudo python2.7. And then to get pip sudo python2.7 -m easy_install pip followed by sudo python2.7 -m easy_install --upgrade pip. The --no-check-certificate option was necessary to get past a complaint from wget about the SSL certificate. (See pypi.python.org/pypi/setuptools#unix-wget)
    – zlovelady
    May 18, 2015 at 20:24

No, it's not considered safe to define 2.7 as your default Python interpreter in Lucid. And I don't think it will be in the future.

  • There are no major version upgrades of any software in one release.

    So python2.7 will not replace 2.6 as the default interpreter. This kind of upgrade is only done between versions, within one - especially an LTS - there are only so called stable release upgrades, i.e. bugfixes and security related upgrades.

However, it's perfectly safe to use python2.7, defining your interpreter as #!/usr/bin/python2.7 and having users install it using make altinstall on the python source, alongside python2.6


There's a PPA with Python 2.7 built for Ubuntu 10.04. It may be safer/more convenient than building from source.


This resolved all sorts of problem I was having https://stackoverflow.com/questions/7561221/undefined-symbol-pyobject-nextnotimplemented-error-when-loading-psycopg2-modu.

Now libpython2.7.so.1.0 is linking to my python2.7 etc all appears to be happier.

Last piece I needed to figure it out was mod_wsgi installation. If you simply issue:

$ apt-get install libapache2-mod-wsgi

Then this will be compiled for Python2.6 :(

$ ldd /usr/lib/apache2/modules/mod_wsgi.so

libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0x00178000)

So I followed instruction provided by Gork-Zope here.

I have finally a working server. Thank you.


i do not think so since it will need to change many of the programs and libraries associated with the 10.04 version. Actually many of the work in Ubuntu is made using a specific python version. Changing it to python would change a lot of system files.

For 10.10 it is available from synaptic/aptitude just by installing python2.7 (you can also install 3 and 3.1) but for 10.04 there is no work made to make it out for 10.04.

10.10 has python 2.6 as the default. Sorry if the answer was not positive but just wanted to give you an idea of the changes.

EDIT - Changed Python 2.7 to Python 2.6 as default since it was double checked from the comments below. Thank you.

  • I just checked out 10.10 in virtual box, it has python 2.6.6 by default, though there are 2.7 packages available for maverick. I think its 11.04 which has it as default. I generally keep on updating and changing distros but was considering to stick on 10.04, for its long term support and my customizations.
    – crodjer
    Dec 17, 2010 at 8:06
  • yep, 11.04 has 2.7 per default since a few days Dec 17, 2010 at 8:42

You must log in to answer this question.

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