CentOS 6.5上安装Python 2.7.8

背景介绍:

centos6.5系统本省自带了Python2.6, 而此系统上同时有需要Python2.7版本。

如何成功安装python另一版本2.7,通过网上资料查询,总结如下:

Note: 

1. centos6.5版本装好后,一些相关的依赖包需要安装,这是安装python2.7的前提依赖项

2. 以下总结几乎可以绕开安装中出现的各式问题


Installing Python 2.7.8 on CentOS 6.5

1.      UpdateCentOS and install development tools

1.1  yum-y update

1.2  yumgroupinstall -y 'development tools'

 

2.      Installthe packages

2.1  yuminstall -y zlib-devel bzip2-devel openssl-devel xz-libs wget

 

3.       Install Python2.7.8 from source

3.1   http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz

3.2   xz -d Python-2.7.8.tar.xz

3.3   tar -xvf Python-2.7.8.tar

3.4   cd Python-2.7.8

3.5   ./configure --prefix=/usr/local

3.6   Make

Note: If failed, please referto Make commanderror

3.7   make altinstall

4.       Create symbolic link forPython2.8

4.1   Check the python version onCentOS 6.5 as follows

[root@localhostbin]# which python

/usr/bin/python

[root@localhostbin]# which python2.7

/usr/local/bin/python2.7

4.2   Check PATH asfollows

[root@localhost bin]# echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/tianxia/bin

             Ensure ‘/usr/local/bin’(python2.7) is prior to ‘/usr/bin’ (python).

4.3   Create symboliclink

4.3.1         cd /usr/local/bin

4.3.2         ln –s Python2.8 python

4.4   Check thedefault python version

[root@localhostbin]# which python

/usr/local/bin/python

[root@localhostbin]# python

Python 2.7.8(default, Jul 16 2015, 01:36:52)

[GCC 4.4.7 20120313(Red Hat 4.4.7-11)] on linux2

Type"help", "copyright", "credits" or"license" for more information.

>>> 

5.       Install Python tool

5.1   Install setuptools

5.1.1         wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4

5.1.2         tar-xvf setuptools-1.4.2.tar.gz

5.1.3         cdsetuptools-1.4.2

5.1.4         python2.7setup.py install

5.2   Install pip

5.2.1         curlhttps://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py |python2.7 -

5.3   Installvirtualenv

5.3.1         pip2.7 install virtualenv

Make command error:

“make” command runs severalhours, (there are much “checking for… ” information on the screen),please ensure system time iscorrect.

If not, please run command justlike:

“data –s2015-**-** 00:00:00”

(http://www.douban.com/group/topic/16474529/)

Reference

1.      http://bicofino.io/blog/2014/01/16/installing-python-2-dot-7-6-on-centos-6-dot-5/

2.      https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值