一.安裝步驟
1.檢查系統python
CentOS 6.8自帶的是Python 2.6.6,yum中最新的也是Python 2.6.6,只能下載Python 2.7.12的源代碼自己編譯安裝。如下圖:
- 安裝Development tools
#yum -y groupinstall "Development tools" - 安裝編譯Python需要的包
#yum install zlib-devel -y
#yum install bzip2-devel -y
#yum install openssl-devel -y
#yum install ncurses-devel -y
#yum install sqlite-devel -y
#yum install tcl-devel –y
#yum install tk-devel -y
4.下載並解壓Python 2.7.12的源代碼
#cd /opt
#wget --no-check-certificate https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
#tar xf Python-2.7.12.tar.xz
#cd Python-2.7.12
#tar xf Python-2.7.12.tar.xz
#cd Python-2.7.12
- 編譯與安裝Python 2.7.12
#./configure --prefix=/usr/local
#make && make install
6.將python命令指向Python 2.7.12cd /usr/bin
#rm –rf python
#ln -s /usr/local/bin/python2.7 /usr/bin/python
#python –version
由上圖所示 python2.7安裝完成
如果對此有興趣,請掃下面二維碼免費獲取更多詳情