centOS里升级python

还是记下来好。


先看看什么版本

[root /]# python -V
Python 2.6.6

安装一些需要的包

[root /]# yum install -y gcc make openssl-devel bzip2-devel expat-devel gdbm-devel readline
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.usc.edu
* extras: mirror.chpc.utah.edu
* updates: linux.mirrors.es.net
Package gcc-4.4.7-16.el6.x86_64 already installed and latest version
Package 1:make-3.81-20.el6.x86_64 already installed and latest version
Package openssl-devel-1.0.1e-42.el6_7.4.x86_64 already installed and latest version
Package bzip2-devel-1.0.5-7.el6_0.x86_64 already installed and latest version
Package expat-devel-2.0.1-11.el6_2.x86_64 already installed and latest version
Package gdbm-devel-1.8.0-38.el6.x86_64 already installed and latest version
Package readline-6.0-4.el6.x86_64 already installed and latest version
Nothing to do

下载python的压缩包

[root /]# wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz

–2016-04-29 05:56:28–
https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz
Resolving www.python.org… 23.235.44.223
Connecting to www.python.org|23.235.44.223|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 19435166 (19M) [application/octet-stream]
Saving to: `Python-3.4.4.tgz’

解压

[root /]# tar -xzf Python-3.4.4.tgz

进入解压后的文件夹

[root /]# cd Python-3.4.4

安装

[root Python-3.4.4]# ./configure
[root Python-3.4.4]# make all
[root Python-3.4.4]# make install

查询python版本,发现还是老版本

[root Python-3.4.4]# python -V
Python 2.6.6

指向新安装的python3.4

[root Python-3.4.4]# mv /usr/bin/python /usr/bin/python2.6
[root Python-3.4.4]# ln -s /usr/local/bin/python3.4 /usr/bin/python

再次查询

[root Python-3.4.4]# python -V
Python 3.4.4

修改yum

vi /usr/bin/yum IT网
把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.6 保存退出即可

参考网站:

http://www.68idc.cn/help/server/linux/20150317279470.html
http://linux.it.net.cn/CentOS/course/2014/0504/1059.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值