centos将默认的python2.6升级到Python2.7

前端之家收集整理的这篇文章主要介绍了centos将默认的python2.6升级到Python2.7前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
#安装Python2.7
yuminstallzlibzlib-devel
wgethttps://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tarxfPython-2.7.12.tgz
cdPython-2.7.12
./configure--enable-shared--enable-loadable-sqlite-extensions--with-zlib
vi./Modules/Setup
将注释去掉
#zlibzlibmodule.c-I$(prefix)/include-L$(exec_prefix)/lib-lz
make&&makeinstall


##备份原有python
mv/usr/bin/python/usr/bin/python.bak
cp/usr/local/bin/python2.7/usr/bin/python

#修改yum
vim/usr/bin/yum
将第一行的#!/usr/bin/python修改成/usr/bin/python2.6

#vi/etc/ld.so.conf
#添加/usr/local/lib
#生效
/sbin/ldconfig

猜你在找的CentOS相关文章