新項目上線,python的版本問題折騰了一些時間,記錄下來,留點痕跡。python
CentOS 6.6自帶的是Python 2.6.6,而項目中使用的語言檢測須要python2.7環境的支持。sql
yum中最新的也是Python 2.6.6,只能下載Python 2.7.8的源代碼本身編譯安裝。python2.7
操做步驟以下:spa
1)安裝devtoolsetcode
yum groupinstall "Development tools"
2)安裝編譯Python須要的包包sqlite
yum install zlib-devel yum install bzip2-devel yum install openssl-devel yum install ncurses-devel yum install sqlite-devel
3)下載並解壓Python 2.7.8的源代碼blog
cd /opt wget --no-check-certificate https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz tar xf Python-2.7.8.tar.xz cd Python-2.7.8
4)編譯與安裝Python 2.7.8ip
./configure --prefix=/usr/local make && make altinstall
5)將python命令指向Python 2.7.8ssl
ln -s /usr/local/bin/python2.7 /usr/local/bin/python
6)檢查Python版本get
sh sh-4.1# python -V Python 2.7.8
至此,服務運行所須要的python環境升級完畢。