yum -y install vim unzip net-tools && yum -y install wget && yum -y install bzip2 && yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel && yum -y install libglvnd-glx && yum -y install gcc gcc-c++ wget https://registry.npmmirror.com/-/binary/python/3.6.8/Python-3.6.8.tgz #下载 tar -xvf Python-3.6.8.tgz && cd Python-3.6.8/ ./configure --prefix=/usr/local/python3.6 make -j $(nproc) && make install #编译安装 ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3 #添加python3软链接 ln -s /usr/local/python3.6/bin/pip3 /usr/bin/pip3 #添加pip3软链接 python3 --version #查看版本
新创建的云主机,在shell中刷此脚本即可。
删除旧版本Python 安装新版本
rm -rf /usr/local/python3.6 wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz tar -xvf Python-3.8.5.tgz && cd Python-3.8.5/ ./configure --prefix=/usr/local/python3.8 make -j $(nproc) && make install ln -sf /usr/local/python3.8/bin/python3.8 /usr/bin/python3 ln -sf /usr/local/python3.8/bin/pip3 /usr/bin/pip3 python3 --version #查看版本
标签:bin,install,Python,devel,python3.6,usr,&&,安装,CentOS7.6 From: https://www.cnblogs.com/yogurt-lids/p/17896938.html