Python 2.x升级到3.x
一、查看当前python版本 [root@bridge] # python -V Python 2 . 7 . 5 二、下载新的python包并安装 进入python官网(https://www.python.org),选择需要的版本。 https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz [root@bridge] # cd Python-3.7.3/ [root@bridge Python-3.7.3] # ./configure [root@bridgePython-3.7.3] # make [root@bridgePython-3.7.3] #make install 三、验证 # python -V #一个是旧版本,一个是新版本 Python 2 . 7 . 5 # python3 -V Python 3 . 7 . 3 四、设置3.X为默认版本 查看 Python 的路径,在 /usr/bin 下面。可以看到 python 链接的是 python 2.7,所以,执行 python 就相当于执行 python 2.7。 [root@bridge bin] # ls -al /usr/bin | grep python lrwxrwxrwx 1 root root 7 Aug 17 2017 python