Installing Python 3 on Ubuntu (and Debian) Linux

I’m still seeing a certain amount of traffic hitting this site from queries searching for help installing Python 3 on Ubuntu and Debian Linux systems. Because of what I would call the conservatism of both distros, unless you are using the very latest releases, you won’t have the latest versions available. I do completely understand the reasons both the Ubuntu and Debian communities have for their update policies, but it does put users in a bind if they want to try Python 3 without updating their entire distribution.

Since I’m really behind the notion of people moving to Python 3 (not only did I write a book about it, Python 3 is a better language), let me recap your options for installing Python 3 on Ubuntu systems. The same approach will work for Debian boxes.

Use a package when you can…

As I mention in The Quick Python Book, the easiest and most reliable way to install Python is to use a precompiled package. If you’re using Karmic or later, that’s no problem. The packages are right there and ready to go. Go for the python3 and idle3 packages and you’ll get a complete Python 3.1 environment with no hassle at all.

You might be able to find precompiled Python 3 packages either on Launchpad.net or elsewhere, but I haven’t found any that are both the latest release of Python and that include IDLE. If you find packages that you trust that meet your requirements, by all means, go for it.

But if you can’t…

However, if you can’t get Python 3.1 packages, you will need to do things the hard way. Note that in Jaunty (8.10) there are Python 3.0 packages, but don’t bother – in the year since the initial release of Python 3.0, there have been several incremental improvements, particularly to file I/O, that mean 3.0 is now just history.

So “the hard way”. As far as I know, the only way to get a complete Python3+IDLE install on versions before Karmic is to compile from source. To do that, you need to follow the instructions in this post, except that you should get the latest version of Python 3.x, currently 3.1.1. The install is pretty resilient – that is, you’re likely to get something, even if you’re missing a few dependencies. If you follow the instructions, you should get everything you need and not have to upgrade your distro until you’re darned good and ready.

About these ads

2 Responses to Installing Python 3 on Ubuntu (and Debian) Linux

  1. [...] for installing Python 3 on Ubuntu systems. The same approach will work for Debian boxes. More here As I mention in The Quick Python Book, the easiest and most reliable way to install Python is to [...]

  2. [...] This post was mentioned on Twitter by vceder, Tawana Thomas, Larry King, Ubuntu Feed, Ammu and others. Ammu said: Installing Python 3 on Ubuntu (and Debian) Linux « Learn Python: I'm still seeing a certain amount of traffic hitt… http://bit.ly/bfGFZ0 [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 131 other followers

%d bloggers like this: