本脚本主要针对python2.6升级至python2.10,并且解决了升级后不能使用yum的问题。添加了ipython功能
#########################
#!/bin/bash
path="/home/tools"
if [ ! -d $path ];then
mkdir $path
else
rm -rf $path && mkdir $path
fi
cd $path
yum -y install automake gcc gcc-c++ readline-devel
wget --no-check-certificate https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
if [ $? -eq 0 ];then
tar xvf Python-2.7.10.tgz
fi
cd Python-2.7.10 && ./configure --with-zlib && make all && make install && make clean && make distclean
if [ $? -eq 0 ];then
rm -rf /usr/bin/python
ln -s /usr/local/bin/python2.7 /usr/bin/python
fi
sed -i ‘1s/$/&2.6/g‘ /usr/bin/yum
wget --no-check-certificate https://pypi.python.org/packages/source/i/ipython/ipython-3.1.0.tar.gz
if [ $? -eq 0 ];then
tar zxvf ipython-3.1.0.tar.gz
fi
cd ipython-3.1.0 && python setup.py install
#install setuptools
cd $path
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-19.2.tar.gz
if [ $? -eq 0 ];then
tar -zxf setuptools-19.2.tar.gz
fi
cd setuptools-19.2
python setup.py install
#install pip
cd $path
wget http://pypi.python.org/packages/source/p/pip/pip-8.1.1.tar.gz
if [ $? -eq 0 ];then
tar -zxf pip-8.1.1.tar.gz
fi
cd pip-8.1.1
python setup.py install
pip install supervisor
pip install uwsgi
pip install ansible==1.9.4
pip install Django==1.8.3
pip install django-users2
pip install MySQL-python
pip install rpyc