一、目的
日常测试中,为快捷在Linux系统下安装不同版本Python并安装pip。
二、脚本
代码语言:javascript复制#!/bin/bash
#mail:xuel@anchnet.com
#function:auto install python
sys_init() {
[ -f /etc/init.d/functions ] && . /etc/init.d/functions
[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
setenforce 0
clear
echo "########################################"
echo "# Auto Install Python ##"
echo "# Press Ctrl C to cancel ##"
echo "# Any key to continue ##"
echo "########################################"
echo "(1) Install Python2.7"
echo "(2) Install zabbix3.6"
echo "(3) Install zabbix3.7"
echo "(4) EXIT"
read -p "Please input your choice:" NUM
case $NUM in
1)
URL="https://www.python.org/ftp/python/2.7/Python-2.7.tgz"
VER=python27
;;
2)
URL="https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz"
VER=python36
;;
3)
URL="https://www.python.org/ftp/python/3.7.0/Python-3.7.0b4.tgz"
VER=python37
;;
4)
echo -e "