在LinuxCentOS6.6上安装Python2.7.9本文适用于Centos6.5
CentOS 6.6自带的是Python 2.6.6,而编译llvm需要Python 2.7以上。
checking for python... /usr/bin/python checking for python >= 2.7... not found configure: error: found python 2.6.6 (/usr/bin/python); required >= 2.7
yum中最新的也是Python 2.6.6,只能下载Python 2.7.9的源代码自己编译安装。
操作步骤如下:
1)安装devtoolset
yumgroupinstall"Developmenttools"
2)安装编译Python需要的包包
yuminstallzlib-devel yuminstallbzip2-devel yuminstallopenssl-devel yuminstallncurses-devel yuminstallsqlite-devel
3)下载并解压Python 2.7.9的源代码
cd/opt wget--no-check-certificatehttps://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz tarxfPython-2.7.9.tar.xz cdPython-2.7.9
4)编译与安装Python 2.7.9
./configure--prefix=/usr/local make&&makealtinstall
5)将python命令指向Python 2.7.9
ln-s/usr/local/bin/python2.7/usr/local/bin/python
6)检查Python版本
sh sh-4.1#python-V Python2.7.9