A-A+

Centos6.x系统python升级到2.7.10脚本

2016年10月09日 Linux, python 暂无评论 阅读 558 views 次

python-logo

 

wget http://down.awkxy.com/Python/upgrade27.sh 
chmod +x upgrade27.sh 
./upgrade27.sh
   代码比较简单:
#!/bin/bash 
if [ `id -u` -ne 0 ] 
then echo "Must root run this script!" 
exit 1 
fi 
yum -y install make gcc gcc-c++ python-devel zlib zlib-devel openssl openssl-devel
wget http://down.awkxy.com/Python/Python-2.7.10.tgz 
tar -xf Python-2.7.10.tgz 
cd Python-2.7.10 
./configure && make all && make install && make clean && make distclean 
mv /usr/bin/python /usr/bin/python2.6 
ln -s /usr/local/bin/python2.7 /usr/bin/python 
sed -i "s@/usr/bin/python@/usr/bin/python2.6@g" /usr/bin/yum

 

在执行之前安装一些基本程序,make,gcc,gcc-c++,python-devel

如果之后安装pip easy_install出现了下面的错误:

    zipimport zipimporterror can t decompress data zlib not available

修改源码包下的Modules/Setup.dist文件,把下面这行的注释去掉:

    #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz 

然后重新编译。

 

标签:

给我留言