Skip to content

Commit c9b7f54

Browse files
committed
python升级脚本
1 parent 5e7952d commit c9b7f54

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

python_upgrade.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /bin/sh
2+
3+
#python2.6升级到2.7一键安装脚本
4+
5+
echo "---------------1.download python2.7 package-----------------------"
6+
cd /tmp
7+
file_name="Python-2.7.12.tgz"
8+
`rm -rf ${file_name}`
9+
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
10+
`tar -zxvf ${file_name}`
11+
12+
echo "--------------------2.build and install---------------------------"
13+
cd Python-2.7.12
14+
./configure
15+
make all
16+
make install
17+
make clean
18+
make distclean
19+
20+
echo "----------------------3.python version---------------------------"
21+
/usr/local/bin/python2.7 -V
22+
23+
echo "----------------------4.modify link------------------------------"
24+
mv /usr/bin/python /usr/bin/python2.6.6
25+
ln -s /usr/local/bin/python2.7 /usr/bin/python
26+
27+
echo "---------------------5.python new version------------------------"
28+
python -V
29+
30+
echo "--------------------6.modify yum config--------------------------"
31+
sed '1/\!\/usr\/bin\/python/\!\/usr\/bin\/python2.6/g' /usr/bin/yum
32+
33+
echo "----------------------success------------------------------------"
34+
35+
#blog
36+
#http://www.cnblogs.com/emanlee/p/6111613.html

0 commit comments

Comments
 (0)