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

centos系统升级python 2.7.3

WBOY
Release: 2016-06-06 11:31:00
Original
1132 people have browsed it

首先下载源tar包

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

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

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

tar -zxvf Python-2.7.3.tgz
Copy after login

进入解压缩后的文件夹

cd Python-2.7.3
Copy after login

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

mkdir /usr/local/python2.7.3

Copy after login

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

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

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

mv /usr/bin/python /usr/bin/python_old
Copy after login

再建立新版本python的链接

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

这个时候输入

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.
>>>
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template