升级 python 从 2.7.3 升级到 2.7.10

步骤1:安装相关依赖

apt-get install build-essential checkinstall
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Notice 如果之前已经安装过,可以直接跳到下一步,但还是建议仔细检测

步骤2:下载 python2.7.10

cd ~/package/
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz

tar xzf Python-2.7.10.tgz

步骤3:编译安装

./configure
 make altinstall(或者  make install)
 

Notice make altinstall 会阻止替换默认的 /usr/bin/python 文件

本文固定链接: http://www.js-code.com/python/python_50308.html