念念不忘
必有回响

CentOS6.8升级Python2.6为Python2.7

默认的Centos的Python版本为2.6,使用pip的时候经常提示Python2.6已过期,那么还是升级到Python2.7吧。

1. 下载文件并解压

wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -zxvf Python-2.7.13.tgz

2. 创建目录

mkdir /usr/local/python2.7

3. 开始编译安装

./configure --prefix=/usr/local/python2.7
make && make install

4. 备份原来的python

mv /usr/bin/python /usr/bin/python_old

5. 重新做软链

ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python
ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7

6. 校验

[root@tvzr Python-2.7.13]# python
Python 2.7.13 (default, May 15 2017, 11:00:16) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
赞(0) 打赏
未经允许不得转载:码农志 » CentOS6.8升级Python2.6为Python2.7
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏