前言:
CentOS 6.X上面安装的python默认版本为2.6.6,但是现在很多库都是要求python2.7,因此一个新系统上面要做的第一件事就是升级Python。
0.安装依赖包
点击(此处)折叠或打开
- [root@localhost ~]# python --version
- Python 2.6.6
- [root@localhost ~]# yum -y update
- [root@localhost ~]# yum groupinstall "Development tools"
- [root@localhost ~]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
1.安装Python2.7
点击(此处)折叠或打开
- [root@localhost ~]# wget http://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
- [root@localhost ~]# tar xf Python-2.7.10.tar.xz
- [root@localhost ~]# cd Python-2.7.10
- [root@localhost ~]# ./configure --prefix=/usr/local
- &&
- &&
- &
- &