shell腳本安裝python、pip--不需要選擇安裝項目
阿新 • • 發佈:2019-02-01
exe HERE ram wall 3.6 evel -i make 出錯
shell腳本安裝python、pip--不需要選擇安裝項目--不管用總報錯,必須帶上判斷符號,while沒有這種用法,寫在這裏為了以後少走彎路,
所以不要用下面的執行了
首先把pip-18.0.tar.gz 、Python-3.6.5.tgz 安裝包放在 /usr/local 下面,按照順序先安裝pip,再安裝python。不要先安裝或只安裝python,否則很容易出錯, #!/bin/bash func1(){ while true do echo "安裝依賴包" yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-develecho "安裝pip" yum remove pip -y && cd /usr/local/ && tar -xf pip-18.0.tar.gz && cd pip-18.0/ && python setup.py install echo "安裝python" 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 sed -i "1c #!/usr/bin/python2.7" /usr/bin/yum sed -i "1c #!/usr/bin/python2.7" /usr/libexec/urlgrabber-ext-down sed -i "1c #!/usr/bin/python2.7" /usr/sbin/firewalld echo "全部安裝完畢" exit done } func1
shell腳本安裝python、pip--不需要選擇安裝項目