如何安装python3.7.4版本_升级为python3.3.7版本步骤

python环境搭建-Linux系统下python2.7升级python3.3.7步骤

首先Python 查看版本 , 在Linux下特别注意权限问题,创建目录时候切记给予权限

升级步骤

升级为python3.3.7版本步骤

#解压到下载目录,在编译前先在/usr/local建一个文件夹python3(以免覆盖老的版本)

[root@svr7 ~]# tar -xf Python-3.3.7rc1.tar.xz

[root@svr7 ~]# cd Python-3.3.7rc1/

#进入解压后的文件夹,

[root@svr7 Python-3.3.7rc1]#mkdir /usr/local/python3

[root@svr7 Python-3.3.7rc1]#./configure --prefix=/usr/local/python3

[root@svr7 Python-3.3.7rc1]#make && make install

编译完成

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

[root@svr7 Python-3.3.7rc1]# mv /usr/bin/python /usr/bin/python_old

[root@svr7 Python-3.3.7rc1]# python

-bash: /usr/bin/python: 没有那个文件或目录

[root@svr7 Python-3.3.7rc1]# ln -s /usr/local/python3/bin/python3 /usr/bin/python

[root@svr7 Python-3.3.7rc1]# python

Python 3.3.7rc1 (default, Sep 7 2017, 21:25:49)

[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>>

[root@svr7 Python-3.3.7rc1]# python --version

Python 3.3.7rc1

PS:如果不建立新安装路径python3,而是直接默认安装,则安装后的新python应该会覆盖linux下自带的老版本,也有可能不覆盖,具体看安装过程了,这个大家可以自己试验下,当然如果还想保留原来的版本,那么这种方法最好不过了。

注意事项:

这种方法虽然能安装成功,但会导致yum不能正常使用。

解决方法:

[root@svr7 Python-3.3.7rc1]# cp /usr/bin/yum /usr/bin/yum.backup

[root@svr7 Python-3.3.7rc1]# vim /usr/bin/yum

修改第一行参数

vi /usr/bin/yum

把 #!/usr/bin/python 修改为:/usr/bin/python_old

把 #!/usr/bin/python 修改为:/usr/bin/python2.7

[root@svr7 Python-3.3.7rc1]# yum repolist

已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

源标识 源名称 状态

rhel7 rhel7-yum 4,620

repolist: 4,620

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值