Home >Backend Development >Python Tutorial >centos系统升级python 2.7.3

centos系统升级python 2.7.3

WBOY
WBOYOriginal
2016-06-06 11:31:001133browse

首先下载源tar包

可利用linux自带下载工具wget下载,如下所示:

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

下载完成后到下载目录下,解压

tar -zxvf Python-2.7.3.tgz

进入解压缩后的文件夹

cd Python-2.7.3

在编译前先在/usr/local建一个文件夹python27(作为python的安装路径,以免覆盖老的版本)

mkdir /usr/local/python2.7.3

在解压缩后的目录下编译安装

./configure --prefix=/usr/local/python2.7.3
make
make install

此时没有覆盖老版本,再将原来/usr/bin/python链接改为别的名字

mv /usr/bin/python /usr/bin/python_old

再建立新版本python的链接

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

这个时候输入

python

就会显示出python的新版本信息

Python 2.7.3 (default, Sep 29 2013, 11:05:02)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn