centos默认安装的是python2,如果安装了宝塔,其他脚本需要用到python3就得共存
#安装环境
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y
yum install libXcomposite libXcursor libXi libXtst libXrandr alsa-lib mesa-libEGL libXdamage mesa-libGL libXScrnSaver -y
yum install libffi-devel -y
下载
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
解压
tar -xvJf Python-3.7.2.tar.xz
编译、安装
cd Python-3.7.2/ ./configure --enable-shared --prefix=/usr/local CFLAGS=-fPIC LDFLAGS="-Wl,-rpath /usr/local/lib" make -j24 make install
设置软链接
ln -sf /usr/local/bin/python3.7 /usr/bin/python3 ln -sf /usr/local/bin/python3.7 /usr/bin/python3.7 ln -sf /usr/local/bin/pip3.7 /usr/bin/pip3 ln -sf /usr/local/bin/pip3.7 /usr/bin/pip3.7