centos系统升级yum默认安装的Python2.6至2.7版

首先查看默认 Python 版本

1
python -V

若版本低于2.7则继续

1
yum groupinstall "Development tools" -y && yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel -y
1
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz && tar xf Python-2.7.12.tar.xz && cd Python-2.7.12 && ./configure -prefix=/usr/local
1
make && make install
1
make clean && make distclean
1
mv /usr/bin/python /usr/bin/python2.6.6 && ln -s /usr/local/bin/python2.7 /usr/bin/python

查看Python升级是否成功

1
Python

升级成功会看到以下信息

原文链接:https://xiaohost.com/3631.html,转载请注明出处。
0

评论0

请先