在Linux CentOS 6.6上安裝Python 2.7.9

CentOS 6.6自帶的是Python 2.6.6,而編譯llvm須要Python 2.7以上。python

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的源代碼本身編譯安裝。git

操做步驟以下:github

1)安裝devtoolsetsql

yum groupinstall "Development tools"

2)安裝編譯Python須要的包包centos

yum install zlib-devel
yum install bzip2-devel
yum install openssl-devel
yum install ncurses-devel
yum install sqlite-devel

3)下載並解壓Python 2.7.9的源代碼python2.7

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.9ui

./configure --prefix=/usr/local
make && make altinstall

5)將python命令指向Python 2.7.9this

ln -s /usr/local/bin/python2.7 /usr/local/bin/python

6)檢查Python版本spa

sh
sh-4.1# python -V
Python 2.7.9

【參考資料】code

Installing python 2.7 on centos 6.3

相關文章
相關標籤/搜索