I'm using Ubuntu 11.10. The python 2.7.2 provided has a bug that has been corrected in the latest 2.7.2 sources from the python repository.

What is the recommended way to replace the ubuntu provided python with the python from source? Or put another way, how do I "update" the ubuntu-provided one? Ideally, I would just be able to create new .deb(s) that "update" the python2.7/python2.7-dev provided by Ubuntu.

  • Use checkinstall: askubuntu.com/questions/87111/… – Javier Rivera Feb 13 '12 at 8:23
  • Unfortunately, it crashes with "ranlib: could not create temporary file whilst writing archive: No more archived files". Secondly, is the produced .deb going to be compatible with the current python2.7 package? It feels like it won't be. Do I somehow have to integrate the mercurial sources with ubuntu -- and then use some other commands? – UsAaR33 Feb 13 '12 at 13:01
  • I don't really know if it will be compatible, it should, but there is no way to know all of the implications. There is a high risk to break the system. – Javier Rivera Feb 13 '12 at 15:06

We apply some patches in Debian/Ubuntu's python, that make it behave a little differently to upstream Python. You can't replace your system python2.7 package with something else, without breaking all other python modules or applying these patches. (I'm particularly thinking of the distutils-install-layout patch).

The easiest answer is: don't.

Next option: Compile it by hand and install it in /usr/local. It won't replace your system python, but you'll be able to use it. This is the best supported way of achieving what you want.

Finally, if this really is something you want to do. Grab the current python2.7 source package, update it to use the new upstream version that you want to use (this will probably require massaging the patches a little). Build. Install. I'm intentionally not going into details here, because it's not going to be that simple :)

| improve this answer | |

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