一键部署Python3版本
#!/bin/bash
install_python3(){
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 wget gcc libffi-devel
wget https://zhao138969.com/LinuxPackage/Linux/Python-3.7.5.tgz
get_file_md5=$(md5sum Python-3.7.5.tgz|awk '{print $1}')
if [ $get_file_md5 == "1cd071f78ff6d9c7524c95303a3057aa" ];then
tar xvf Python-3.7.5.tgz
cd Python-3.7.5
./configure --enable-shared --prefix=/usr/local/python3 -enable-unicode=ucs4
make -j 2 && make install
# 添加Python环境变量到/etc/profile
echo "export PYTHON_HOME=/usr/local/python3" >>/etc/profile
echo "export PATH=\${PATH}:\${PYTHON_HOME}\"/bin\"" >>/etc/profile
source /etc/profile
# 设置Python安装镜像源为阿里云
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
echo 'pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple' >> ~/.bash_profile
echo 'export LD_LIBRARY_PATH=/usr/local/python3/lib' >> ~/.bash_profile
echo 'export python_home=/usr/local/python3' >> ~/.bash_profile
echo 'export PATH=$PATH:$python_home/bin' >> ~/.bash_profile
source ~/.bash_profile
pip list
echo "=====`date`===== Python-3.7.5 install success !!!====="
else
echo download Python-3.7.5.tgz file error
fi
}
install_python3
curl -s https://zhao138969.com/LinuxPackage/Linux/install_pyhton3.sh |bash
评论区