0
点赞
收藏
分享

微信扫一扫

centos7 从python 2.7升级到python 3.6

以前干嘛去了 2022-01-10 阅读 76
python

1.检查之前系统的python版本

[root@localhost ~]# python
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
>>>
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>
[root@localhost ~]#

2.确保可以使用yum源进行升级

具体命令:

  1. yum groupinstall ‘Development Tools’

  2. yum install centos-release-scl

  3. yum install rh-python36

  4. python --version
    python 2.7.5

  5. scl enable rh-python36 bash
    Python 3.6.3

  6. yum -y install python-pip

[root@bogon ~]# python
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>>
[root@bogon ~]# scl enable rh-python36 bash
[root@bogon ~]# python --version
Python 3.6.12
[root@bogon ~]# python
Python 3.6.12 (default, Oct 23 2020, 13:36:31)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>>

举报

相关推荐

0 条评论