Ubuntu 10.04默认带的Python 2.6,一些程序运行又需要老版本(2.5)的Python,比如备份Gmail的这个Gmail Backup,简单记录安装过程如下:

1.下载安装OpenSSL

可以用apt-get方式

sudo apt-get install libssl-dev

也可以之间下载源码编译安装

wget http://www.openssl.org/source/openssl-1.0.0e.tar.gz

tar xzvf openssl-1.0.0e.tar.gz

cd openssl-1.0.0e

./configure

make

sudo make install

2.下载Python 2.5的源码包,解压

sudo apt-get install build-essential gcc

cd Downloads

wget http://www.python.org/ftp/python/2.5.5/Python-2.5.5.tgz

tar -xvzf Python-2.5.5.tgz

cd Python-2.5.5

修改文件 Modules/Setup.dist,添加

# Socket module helper for SSL support; you must comment out the other

# socket line above, and possibly edit the SSL variable:

SSL=/usr

_ssl _ssl.c \

-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \

-L$(SSL)/lib -lssl –lcrypto

编译安装

./configure –prefix=/usr/local/python2.5

make

make test

sudo make install

sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5

OK