#!/bin/bash#. /etc/init.d/functionscat END +----------------------------------+| || This is install python || || 1...
#!/bin/bash
#. /etc/init.d/functions
cat <<END
+----------------------------------+
| |
| This is install python |
| |
| 1.安装依赖环境 |
| 2.安装pip |
| 3.安装python3.5 |
| |
+----------------------------------+
END
#node 0.
read -p "请你输入一个数字:" NUM
# expr $NUM + 1 &> /dev/null
if [ "$?" -ne 0 ];then
echo "对不起,请你输入整数!!!" /bin/false
exit 1
elif [ "$NUM" -eq 0 ];then
echo "对不起,请你输入比0大的数字!!!" /bin/false
exit 1
fi
#node 1.
[ "$NUM" = "1" ] && {
echo "首先安装依赖包"
yum -y groupinstall "Development tools" && 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
}
#node 2.
[ "$NUM" = "2" ] && {
echo "开始安装pip-18,请稍后.........."
yum remove pip -y && cd /usr/local/ && tar -xf pip-18.0.tar.gz && cd pip-18.0/ && python setup.py install
}
#node 3.
[ "$NUM" = "3" ] && {
echo "开始安装python3.6.5,请稍后.........."
cd /usr/local/ && tar -zxvf Python-3.6.5.tgz && mv Python-3.6.5 python3 && cd python3 && ./configure && make && make install
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python3 /usr/bin/python && ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
whereis pip && /usr/local/bin/pip3.6 install --upgrade pip && /usr/local/bin/pip install paramiko
echo "配置yum"
sed -i 's/usr\/bin\/python/usr\/bin\/python2.7/g' /usr/bin/yum && sed -i 's/usr\/bin\/python/usr\/bin\/python2.7/g' /usr/libexec/urlgrabber-ext-down
}
本文标题为:shell脚本安装python、pip
基础教程推荐
- 基于Python实现股票数据分析的可视化 2023-08-04
- Centos7下安装python环境 2023-09-04
- 四步教你学会打包一个新的Python模块 2022-10-20
- centos系统 anaconda3(python3)安装pygrib 2023-09-04
- Python爬取当网书籍数据并数据可视化展示 2023-08-11
- python的环境conda简介 2022-10-20
- ubuntu 18 python3.6 的安装与 python2的版本切换 2023-09-03
- Python基础学习之函数和代码复用详解 2022-09-02
- Python 中 Elias Delta 编码详情 2023-08-08
- CentOS 7.5 安装 Python3.7 2023-09-03