root用戶權(quán)限
# vim install_python3.sh
1
#!/bin/sh
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 libffi-devel
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar -zxvf Python-3.7.0.tgz
mkdir /usr/local/python3
cd Python-3.7.0
./configure --prefix=/usr/local/python3
make make install
[ -f /usr/bin/python3 ] mv /usr/bin/python3 /usr/bin/python3_old
[ -f /usr/bin/pip3 ] mv /usr/bin/pip3 /usr/bin/pip3_old
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
ps:下面看下shell腳本--一鍵安裝python3+pip
安裝python3.6.1
#!/bin/bash
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel epel-release gcc
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar vxf Python-3.6.1.tgz
cd Python-3.6.1
./configure --prefix=/usr/local
make make install
cd ..
yum -y install python-pip
安裝python3.6.6
yum install zlib zlib-devel readline-devel sqlite-devel bzip2-devel openssl-devel gdbm-devel libdbi-devel ncurses-libs kernel-devel libxslt-devel libffi-devel python-devel zlib-devel openldap-devel sshpass gcc git -y
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm -y
yum install Percona-Server-server-56 install Percona-Server-devel-56 -y
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz #CentOS 7不用安裝python2.7
tar -xzvf Python-3.6.6.tgz
cd Python-3.6.6
./configure --prefix=/usr/local/python3
make all
make install
make clean
make distclean
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
總結(jié)
以上所述是小編給大家介紹的shell自動(dòng)安裝python3的腳本寫(xiě)法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
您可能感興趣的文章:- CentOS7中使用shell腳本安裝python3.8環(huán)境(推薦)
- python shell命令行中import多層目錄下的模塊操作
- Python IDLE或shell中切換路徑的操作
- 使用python執(zhí)行shell腳本 并動(dòng)態(tài)傳參 及subprocess的使用詳解
- 在python shell中運(yùn)行python文件的實(shí)現(xiàn)
- python3模擬實(shí)現(xiàn)xshell遠(yuǎn)程執(zhí)行l(wèi)iunx命令的方法
- Python3交互式shell ipython3安裝及使用詳解