欢迎访问www.showerlee.com, 您的支持就是我前进的动力.

CentOS6升级python到2.7版本

showerlee 2015-10-29 15:34 Programming, PYTHON 阅读 (11,849) 3条评论

1.安装依赖包

# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel wget xz -y

2.编译安装python2.7

# cd ~ 

# wget --no-check-certificate https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz

# tar xvfJ Python-2.7.9.tar.xz 

# cd Python-2.7.9

# ./configure --prefix=/usr/local LDFLAGS="-Wl,-rpath /usr/local/lib"

# make && make altinstall

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

退出SSH并重新登录

# python -V

Python 2.7.9

# which python

/usr/local/bin/python

3.安装python setuptools

# python ez_setup.py

# which easy_install

/usr/local/bin/easy_install

# /usr/local/bin/easy_install-2.7 pip

# ll /usr/local/bin

total 6136
-rwxr-xr-x 1 root root     101 Oct 29 02:34 2to3
-rwxr-xr-x 1 root root     323 Oct 29 02:42 easy_install
-rwxr-xr-x 1 root root     331 Oct 29 02:42 easy_install-2.7
-rwxr-xr-x 1 root root      99 Oct 29 02:34 idle
-rwxr-xr-x 1 root root     287 Oct 29 02:48 pip
-rwxr-xr-x 1 root root     289 Oct 29 02:48 pip2
-rwxr-xr-x 1 root root     293 Oct 29 02:48 pip2.7
-rwxr-xr-x 1 root root      84 Oct 29 02:34 pydoc
lrwxrwxrwx 1 root root      24 Oct 29 02:36 python -> /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 6224569 Oct 29 02:34 python2.7
-rwxr-xr-x 1 root root    1687 Oct 29 02:34 python2.7-config
-rwxr-xr-x 1 root root   18547 Oct 29 02:34 smtpd.py

升级完毕

正文部分到此结束
版权声明:除非注明,本文由(showerlee)原创,转载请保留文章出处!
本文链接:http://www.showerlee.com/archives/1706

继续浏览:

3条大神的评论

loading
  1. 沙发
    opdev.cn2016年6月23日下午5:35 回复

    这种方式会破环系统python依赖,比如yum,推荐用scl方式

发表评论

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif