CentOS7下 Python2.7.5升级为Python2.7.13
参考:https://www.jianshu.com/p/fad3942fc0ed
第一步:查看Centos版本及Python版本
• CentOS版本
[root@ tools_package]# cat /etc/centos-release
CentOS Linux release 7.4. (Core)
• Python版本
[root@192 tools_package]# python -V
Python 2.7.5
[root@192 tools_package]# ll /usr/bin/python*
lrwxrwxrwx. 1 root root 7 Nov 14 18:14 /usr/bin/python -> python2
lrwxrwxrwx. 1 root root 9 Nov 14 18:14 /usr/bin/python2 -> python2.7
-rwxr-xr-x. 1 root root 7136 Aug 4 08:40 /usr/bin/python2.7
-rwxr-xr-x 1 root root 1835 Aug 4 08:39 /usr/bin/python2.7-config
lrwxrwxrwx 1 root root 16 Jan 20 15:02 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root 14 Jan 20 15:02 /usr/bin/python-config -> python2-config
第二步:从官网下载Python对应版本的包(以2.7.13为例)
[root@ tools_package]#wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz # wget 后接python官网对应的链接
第三步:加压、配置、编译、安装Python2.7.13
• 解压
[root@ tools_package]# tar -zxvf Python-2.7..tgz # 解压命令
• 安装gcc(在编译时会依赖)
[root@192 tools_package]# yum install gcc* openssl openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel python-devel zlib
• 配置、编译、安装
[root@ tools_package]# cd Python-2.7.13
[root@192Python-2.7.13]# (sudo)./configure --prefix=/usr/local # [配置]指定可执行文件、库文件、配置文件、资源文件的安装路径。若没有权限加sudo
[root@192 Python-2.7.13]# (sudo) make # 编译
[root@192Python-2.7.13]#make altinstall # 不要使用make install,否则会覆盖系统自带python
第四步:安装后环境检查
• Python安装后的版本
[root@192 Python-2.7.13]# python -V # 发现版本还是原版本 Python 2.7.
• 安装前后的Python对比
[root@ Python-2.7.]# ll /usr/bin/python* #系统自带的
lrwxrwxrwx. root root Nov : /usr/bin/python -> python2
lrwxrwxrwx. root root Nov : /usr/bin/python2 -> python2.
-rwxr-xr-x. root root Aug : /usr/bin/python2.
-rwxr-xr-x root root Aug : /usr/bin/python2.-config
lrwxrwxrwx root root Jan : /usr/bin/python2-config -> python2.-config
lrwxrwxrwx root root Jan : /usr/bin/python-config -> python2-config
[root@ Python-2.7.]# ll -l /usr/local/bin/python* #手工安装的
-rwxr-xr-x root root Jan : /usr/local/bin/python2.
-rwxr-xr-x root root Jan : /usr/local/bin/python2.-config
[root@ Python-2.7.]#
• 备份旧版本,连接新版本
[root@ Python-2.7.]# mv /usr/bin/python /usr/bin/python2.7.5 #mv 文件名 文件名 意思:将源文件改为目标文件名
[root@ Python-2.7.]# ll -l /usr/bin/python*
lrwxrwxrwx root root 3月 : /usr/bin/python2 -> python2.
-rwxr-xr-x root root 11月 : /usr/bin/python2.
lrwxrwxrwx root root 3月 : /usr/bin/python2.7.5 -> python2 # 改为2.7.5
-rwxr-xr-x root root 11月 : /usr/bin/python2.-config
lrwxrwxrwx root root 4月 : /usr/bin/python2-config -> python2.-config
lrwxrwxrwx root root 4月 : /usr/bin/python-config -> python2-config
[root@ Python-2.7.]# ln -s /usr/local/bin/python2. /usr/bin/python # 增加连接
[root@ Python-2.7.]# ll -l /usr/bin/python*
lrwxrwxrwx root root 4月 : /usr/bin/python -> /usr/local/bin/python2. # 新增的,并指向新安装的python
lrwxrwxrwx root root 3月 : /usr/bin/python2 -> python2.
-rwxr-xr-x root root 11月 : /usr/bin/python2.
lrwxrwxrwx root root 3月 : /usr/bin/python2.7.5 -> python2
-rwxr-xr-x root root 11月 : /usr/bin/python2.-config
lrwxrwxrwx root root 4月 : /usr/bin/python2-config -> python2.-config
lrwxrwxrwx root root 4月 : /usr/bin/python-config -> python2-config
• 再次检查Python版本
[root@ Python-2.7.]# python -V
Python 2.7.
• 若想访问老版本Python(如2.7.5版本)
[root@ Python-2.7.]# python2.7.5 -V
Python 2.7.
CentOS7下 Python2.7.5升级为Python2.7.13的更多相关文章
- 技巧方法 - CentOS6将Python2.6.6升级到Python2.7.6
1.首先使用“python -V”命令查看python版本,我们测试主机显示的是2.6.6版,于是下面就着手将python2.6.6升级到Python2.7.6.python -V #查看python ...
- linux - python2.6.6 升级到python2.7.14
一.升级 Python 2.7.14 版本 1. 准备安装包,系统是最小化安装 # 下载安装依赖的相关包[root@vip ~]# yum install vim gcc make wget -y [ ...
- linux python2.6.6升级到python2.7
升级 python 2.6.6 系统到 2.7.10 版本 CentOS 6 系统默认 Python 版本是:2.6.6 平时在使用中遇到很多的库要求是 2.7.x 版本的库,比如使用 ConfigP ...
- centos7下安装Python3.7(与python2共存)
2019-01-22 22:50:05 centos7默认安装的是python2.7,然而python2基本上要淘汰了,所以有必要安装最新的python3 python,g++这些工具一般安装在/ ...
- centos的python2.6.x升级到python2.7.x方法;python2.6.x的版本就不要用了
python2.6.x的版本,现在使用的很多插件都不支持了.所以如果你的centos还是使用的2.6.x版本,不要犹豫,赶紧升级到2.7.x版本 1.所谓升级,就是再安装一个python2.7.x版本 ...
- Python 2.6.6升级到Python2.7.15
最近在使用Python处理MySQL数据库相关问题时,需要用到Python2.7.5及以上版本,而centos6.5等版本操作系统默认自带的版本为2.6.6,因此需要对python进行升级. Pyth ...
- Linux CentOS7下安装python3
在CentOS7下,默认安装的就是python2.7,我现在来教大家如何安装python3: 1.首先安装python3.6可能使用的依赖 # yum -y install openssl-devel ...
- CentOS7 下源码安装 python3
CentOS 7 下源码安装 python3 在CentOS7下,默认安装的是python2.7:为满足项目要求,安装python3 的方法如下: 1. 首先安装python3.6可能使用的依 ...
- centos7下python2环境安装pip2、kazoo、bottle、beaker
摘自:https://mp.weixin.qq.com/s?src=11×tamp=1576355125&ver=2034&signature=mNp2na6VjFz ...
随机推荐
- 配置springMVC
1.web.xml 前端控制器 配置规则:*.do: 拦截请求路径所有的后缀为.do;/* : 拦截所有, .jsp页面也会拦截; 不会使用此配置, 因为视图会无法跳转;/ : 拦截所有, .jsp页 ...
- 数学整合 新(LUOGU)
1.卡特兰数(P2532) 递推式:h(n)=C(2n,n)/(n+1) (n=0,1,2,...) 前十项(从零开始):1, 1, 2, 5, 14, 42, 132, 429, 1430, 486 ...
- nfs文件系统在linux下挂载不上的解决办法
标签: mount nfs export 2014年08月07日 18:46:247472人阅读 评论(0) 收藏 举报 分类: 文件系统(10) 版权声明:本文为博主原创文章,未经博主允许 ...
- 泛型约束where条件的使用(通过类型参数动态反射创建实例)
定义抽象的人类 using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...
- Eclipse使用。
1. 如何把项目部署到jetty根目录. 先部署.然后在jetty安装根目录下找到contexts,在里面找到你项目名.xml文件.打开后,把<Set name="configurat ...
- 内建类型,与用户自定义类型,返回值为const
1对内建类型来说,按值返回的是否为const,是无关紧要的,因为编译器已经不让它成为一个坐直,因为它总是一个值,而不是一个变量(thing in c++ page192) 2当处理用户自定义的类型时, ...
- 2018.10.22 bzoj4380: [POI2015]Myjnie(区间dp)
传送门 区间dp好题. f[i][j][k]f[i][j][k]f[i][j][k]表示区间[i,j][i,j][i,j]最小值为kkk时的最大贡献. 然后可以枚举端点转移. 当时口胡到这儿就不会了. ...
- 2018.10.17 NOIP模拟 管道(状压dp)
传送门 状压dp好题. 怎么今天道道题都有点东西啊 对于今天题目神仙出题人先膜为上策:%%%%DzYoAk_UoI%%%% 设f[i][j]f[i][j]f[i][j]表示选取点的状态集合为iii,当 ...
- 20155302 2016-2017-2 《Java程序设计》第六周学习总结
20155302 2016-2017-2 <Java程序设计>第6周学习总结 教材学习内容总结 Java中的流分为两种,一种是字节流,另一种是字符流,分别由四个抽象类来表示(每种流包括输入 ...
- Codeforces807 B. T-Shirt Hunt 2017-05-08 23:23 175人阅读 评论(0) 收藏
B. T-Shirt Hunt time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...