Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Being new to Linux, I chose Debian for my Linode because it seemed stable and secure. Now I want to write some sysadmin-type scripts in Python to teach myself the language. Based on this SO question I've decided to go with Python 3. At very least, I'd like my Linode to have 2.6 or 2.7 because that's what's installed on my home machines. But the default for Debian is still 2.5.

That's fine, but for the life of me I cannot figure out how to get the python3.1 package!! It's driving me nuts!

Here's a sample of what I've tried (after running apt-get update to make sure my package index was up to date):

$ apt-cache search ^python$
python - An interactive high-level object-oriented language (default version)
$ apt-cache search ^python3$
$ apt-cache search ^python*$
python - An interactive high-level object-oriented language (default version)
$ apt-cache -a search ^python*$
python - An interactive high-level object-oriented language (default version)
$ apt-cache search ^python2\.4$
python2.4 - An interactive high-level object-oriented language (version 2.4)

I know that this package is available because I can see it right there on debian.org. How do I find it and install it?

And after I finally figure out how to install the latest Python, am I still going to have trouble from my package manager when installing things that depend on Python? Are they going to point to the default python instead of the one I want? I'd much rather use the native package manager than use easy_install (see the reason I care about packages here).

Oh, and I am looking for a command-line-only answer.

share|improve this question
    
See also this similar question at Super User. –  Gilles Jan 18 '11 at 22:39
add comment

2 Answers

up vote 2 down vote accepted

I'm going to assume you've got Debian lenny and have your sourcelist geared towards the stable release which by default only has python2.5 (someone correct me?)

From a brief scan of their package tree, python3.1 exists in the Debian Sid (unstable) and Debian Squeeze (testing) tree. See Here

You can w-get directly from the links provided, but that's often messy as you'll need to resolve any dependencies yourself through a game of what don't I have? with the CLI.

If you're apt for switching your package tree to squeeze, you can change your /etc/apt/sources.list to match that of the squeeze tree. From there, you can aptitude update then aptitude install python and you should have python3.1 and all its dependencies in tow.

share|improve this answer
3  
A warning though about installing squeeze packages on lenny. You may end up installing many more packages than you bargained for due to dependencies and you may begin to encounter obscure errors. In general it is better to be entirely on testing than to try to half-and-half it. –  bahamat Jan 18 '11 at 3:47
    
Thanks, that explains it. I didn't understand that there were different versions of Debian. I was wondering what all those weird nicknames were about. –  Neil Traft Jan 18 '11 at 15:11
add comment

I wrote elsewhere that if you are mainly interested in stability, Squeeze (was then soon to be declared stable) is your best bet at the moment. The easier solution is to do a fresh install of it (download page).

Another option is to upgrade. If you choose this option:

  1. In "/etc/apt/sources.list", replace all occurences of lenny (sometimes labeled stable) with squeeze.
  2. Proceed to the usual apt-get update && apt-get upgrade.
  3. Monitor what will be installed (to ensure that you wont screw your precious installation).

[note] The default Python version in Squeeze is 2.6, and is planned to be made 2.7 after release.

share|improve this answer
add comment

Your Answer

 
discard

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.