一、whereis python

    python: /usr/bin/python.bak /usr/bin/python2.7 /usr/bin/python /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz

 

二、cp /usr/bin/python  /usr/bin/python.bak

三、使用 python -V 命令查看一下是否安装Python

四、yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

五、

去官网下载编译安装包或者直接执行以下命令下载

wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz

tar  -xvf Python-3.6.2.tar.xz

切换进入

cd Python-3.6.2

编译安装

./configure prefix=/usr/local/python3

make && make install

安装完毕,/usr/local/目录下就会有python3了

六、修改默认为python3

      rm  /usr/bin/python

[root@pc bin]# ln -s /usr/local/python3/bin/python3 /usr/bin/python  做个软连接
[root@pc bin]# python -V
Python 3.6.2