-
Notifications
You must be signed in to change notification settings - Fork 26
/
python_upgrade.sh
36 lines (27 loc) · 1.02 KB
/
python_upgrade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh
#python2.6升级到2.7一键安装脚本
echo "---------------1.download python2.7 package-----------------------"
cd /tmp
file_name="Python-2.7.12.tgz"
`rm -rf ${file_name}`
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
`tar -zxvf ${file_name}`
echo "--------------------2.build and install---------------------------"
cd Python-2.7.12
./configure
make all
make install
make clean
make distclean
echo "----------------------3.python version---------------------------"
/usr/local/bin/python2.7 -V
echo "----------------------4.modify link------------------------------"
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
echo "---------------------5.python new version------------------------"
python -V
echo "--------------------6.modify yum config--------------------------"
sed '1/\!\/usr\/bin\/python/\!\/usr\/bin\/python2.6/g' /usr/bin/yum
echo "----------------------success------------------------------------"
#blog
#http://www.cnblogs.com/emanlee/p/6111613.html