歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 在Linux CentOS 6.6上安裝Python 2.7.9

在Linux CentOS 6.6上安裝Python 2.7.9

日期:2017/2/28 14:02:08   编辑:Linux教程

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

yum groupinstall "Development tools"

2)安裝編譯Python需要的包包

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

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

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

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
Python 2.7.9

【參考資料】

Installing python 2.7 on centos 6.3

--------------------------------------分割線 --------------------------------------

CentOS上源碼安裝Python3.4 http://www.linuxidc.com/Linux/2015-01/111870.htm

《Python核心編程 第二版》.(Wesley J. Chun ).[高清PDF中文版] http://www.linuxidc.com/Linux/2013-06/85425.htm

《Python開發技術詳解》.( 周偉,宗傑).[高清PDF掃描版+隨書視頻+代碼] http://www.linuxidc.com/Linux/2013-11/92693.htm

Python腳本獲取Linux系統信息 http://www.linuxidc.com/Linux/2013-08/88531.htm

在Ubuntu下用Python搭建桌面算法交易研究環境 http://www.linuxidc.com/Linux/2013-11/92534.htm

Python 語言的發展簡史 http://www.linuxidc.com/Linux/2014-09/107206.htm

Python 的詳細介紹:請點這裡
Python 的下載地址:請點這裡

更多CentOS相關信息見CentOS 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=14

Copyright © Linux教程網 All Rights Reserved