3

I'd like to have a reliable way to install Python interpreters 2.4 through to Python 3.3 on a linux user account. I am fine to presume that there is a C-compiler but i'd like to avoid relying on particular distributions or distribution versions. Is there already something maybe like a simple python script?

update: i am looking for a script/way to do all downloading and installation automatically and report back any problems in a concise summary.

hpk42
  • 21,501
  • 4
  • 47
  • 53

4 Answers4

3

There is something called pythonbrew: https://github.com/utahta/pythonbrew Take a look, maybe this is what you need.

  • pythonbrew seems to have improved and has better defaults than last time i checked it, thanks for re-pointing to it. I could install python2.4 through to 3.2 quite easily. – hpk42 Jun 03 '12 at 14:14
2

Take a look at the python buildout, a zc.buildout setup for building python versions 2.4-2.7, 3.2 and 3.3.

Originally conceived for building multiple python versions on Mac, I believe it should work on Linux just as well.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Ran into an error with Python-2.5 - filed and issue about it: https://github.com/collective/buildout.python/issues/12 – hpk42 Jun 03 '12 at 13:24
  • it seemed to me that the buildout took care to download various bits and pieces - and pythonbrew was able to install from source, so i suspect a recipe problem. – hpk42 Jun 03 '12 at 14:16
1

You can compile Python for yourself easily enough. Download and extract the Python source tarballs, then use this sequence of commands instead of the usual:

$ ./configure --prefix=$HOME/local
$ make
$ make install

You will probably want to add $HOME/local/bin to your PATH. The different minor/major versions of Python will not interfere with each other, so you can install 2.4, 2.5, 2.6, 2.7, 3.1, 3.2, and 3.3 all at the same time. (There's no point in testing your code against 3.0.)

The program python will be an alias for one of the specific Python versions, such as python2.6.

Dietrich Epp
  • 205,541
  • 37
  • 345
  • 415
  • Thanks for writing out this information. I am actually aware of this but i'd like to have a script that does all the downloading and installation and reports any errors in a concise summarized way. – hpk42 Jun 03 '12 at 13:04
  • Isn't version number being added to name of executable only if `altinstall` is used? See http://stackoverflow.com/a/2547577/95735 – Piotr Dobrogost Oct 27 '12 at 12:34
  • @PiotrDobrogost: Thanks for the link, I didn't know about altinstall. But it's the other way around, so if install creates `python2.7` and `python`, then altinstall creates just `python2.7`. So both versions always create the file with the version number attached. – Dietrich Epp Oct 27 '12 at 15:46
0
#!/bin/bash

cd ~/Downloads
wget http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tar.bz2
tar xvjf Python-2.4.3.tar.bz2
cd Python-2.4.3
./configure
make
sudo make install
make clean
charmoniumQ
  • 5,214
  • 5
  • 33
  • 51