centos 安裝python2.7

自帶的是python2.6版本,現階段須要 安裝pyhdfs使用python操做hdfs,因此須要2.7及以上版本python

1)安裝devtoolsetsql

yum groupinstall "Development tools"

2)安裝編譯Python須要的包包python2.7

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的源代碼code

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

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

5)將python命令指向Python 2.7.9blog

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

6)檢查Python版本ip

sh
sh-4.1# python -V
Python 2.7.9
相關文章
相關標籤/搜索