环境:
Centos6.7
python 2.7.9
1,安装Centos操作系统:
yum update
yum -y install vim wget
2,安装python2.7.9
CentOS 6.6自带的是Python 2.6.6,而编译llvm需要Python 2.7以上。yum中最新的也是Python 2.6.6,只能下载Python 2.7.9的源代码自己编译安装。
1)安装devtoolset
yum groupinstall "Development tools"
2)安装编译Python需要的包包
yum -y install zlib-devel yum -y install bzip2-devel yum -y install openssl-devel yum -y install ncurses-devel yum -y install sqlite-devel
3)下载并解压Python 2.7.9的源代码
cd /opt wget --no-check-certificate https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz tar xf Python-2.7.9.tar.xz cd Python-2.7.9
4)编译与安装Python 2.7.9
./configure --prefix=/usr/local make && make install
5)将python命令指向Python 2.7.9
mv /usr/local/bin/python /usr/local/bin/python2.6 ln -s /usr/local/bin/python2.7 /usr/local/bin/python
6)检查Python版本 python -V
本文出自 “野山羊” 博客,请务必保留此出处http://yeshanyang.blog.51cto.com/8845896/1772295
原文地址:http://yeshanyang.blog.51cto.com/8845896/1772295