Okay for centos 6.4 also On apu.0xdata.loc, after this install was done

  1. $ which python
  2. /usr/local/bin/python
  3. $ python -V
  4. Python 2.7.3
  5. $ ls -ltr /usr/local/bin/pyth*
  6. lrwxrwxrwx 1 root root 24 Jan 30 2013 /usr/local/bin/python -> /usr/local/bin/python2.7
  7. -rwxr-xr-x 1 root root 6162289 Sep 3 00:59 /usr/local/bin/python2.7
  8. -rwxr-xr-x 1 root root 1624 Sep 3 01:00 /usr/local/bin/python2.7-config

So yum will use '/usr/bin/python' which is 2.6

  1. $ /usr/bin/python -V
  2. Python 2.6.6

"python" will give you python 2.7.

"python2.7" will give you python 2.7.

"easy_install" and "easy_install-2.7" will easy install for python 2.7. While separate files, they both seem to install into /usr/local/lib/python2.7/site-packages/

  1. $ ls -ltr /usr/local/bin | grep easy_
  2. -rwxr-xr-x 1 root root 340 Jan 30 2013 easy_install-2.7
  3. -rwxr-xr-x 1 root root 332 Jan 30 2013 easy_install

note the dash before the 2.7

The easy_install's in /usr/bin are for 2.6

  1. $ ls -ltr /usr/bin/easy*
  2. -rwxr-xr-x. 1 root root 331 Nov 11 2010 /usr/bin/easy_install-2.6
  3. -rwxr-xr-x. 1 root root 323 Nov 11 2010 /usr/bin/easy_install

I would recommend python 2.7 on all local machines

I suspect everyone is already ok?. To check:

  1. [root@apu etc]# python -V
  2. Python 2.7.3

Instructions for python 2.7 install on windows 7, ubuntu, mac will be on another page.

Because of centos 6.3 on the cluster machines, we need both 2.6 and 2.7 to coexist there. hopefully only there.

Centos relies on python 2.6 for yum

if you install python 2.7 in any way other than the following you will destroy the system and make yum inoperable

zlib failure message may be from internal python scripts doing uncompression and they may be referring to python module files, rather than looking at links directly. Not sure.

I believe only the x86_64 zlib is needed. i.e. you don't need 32-bit and 64-bit, but just follow these instructions. They worked on apu.0xdata.loc (192.168.1.160) on 9/28/2012

to check centos version

  1. [root@apu etc]# cat /etc/redhat-release
  2. CentOS release 6.3 (Final)

(also okay for centos 6.4)

How to install Python 2.7.6 on CentOS 6.3 (6.2 and 6.4 okay too, probably others)

stolen from Daniel Eriksson. Thanks Daniel!

http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/

(modified a little)

CentOS 6.2 ships with Python 2.6.6 and depends on that specific version. Be careful not to replace it or bad things will happen. If you need access to a newer version of Python you must compile it yourself and install it side-by-side with the system version.

Here are the steps necessary to install Python 2.7.6. Execute all the commands below as root. Either log in as root temporarily or use sudo.

Install development tools

In order to compile Python you must first install the development tools:

  1. yum groupinstall "Development tools"

You also need a few extra libs installed before compiling Python or else you will run into problems later when trying to install various packages:

  1. yum install zlib-devel
  2. yum install bzip2-devel
  3. yum install openssl-devel
  4. yum install ncurses-devel

Download, compile and install Python

The --no-check-certificate is optional

  1. cd /opt
  2. wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
  3. tar xf Python-2.7.6.tar.xz
  4. cd Python-2.7.6
  5. ./configure --prefix=/usr/local
  6. make && make altinstall

It is important to use altinstall instead of install, otherwise you will end up with two different versions of Python in the filesystem both named python.

(Depending on your version of wget, you may need to add the --no-check-certificate option to the wget command line.)

After running the commands above your newly installed Python 2.7.6 interpreter will be available as /usr/local/bin/python2.7 and the system version of Python 2.6.6 will be available as /usr/bin/python and /usr/bin/python2.6.

Check with:

  1. root@lg1:/opt/Python-2.7.6 ] ls -ltr /usr/bin/python*
  2. lrwxrwxrwx 1 root root 6 Nov 16 2002 /usr/bin/python2 -> python
  3. -rwxr-xr-x 1 root root 1418 Jul 10 2013 /usr/bin/python2.6-config
  4. -rwxr-xr-x 2 root root 4864 Jul 10 2013 /usr/bin/python2.6
  5. -rwxr-xr-x 2 root root 4864 Jul 10 2013 /usr/bin/python
  6. lrwxrwxrwx 1 root root 16 Oct 24 15:39 /usr/bin/python-config -> python2.6-config
  7. root@lg1:/opt/Python-2.7.6 ] ls -ltr /usr/local/bin/python*
  8. -rwxr-xr-x 1 root root 6214533 Mar 19 22:46 /usr/local/bin/python2.7
  9. -rwxr-xr-x 1 root root 1674 Mar 19 22:46 /usr/local/bin/python2.7-config

If things don't look right, you might need to create a symbolic link in /usr/local/bin

  1. cd /usr/local/bin
  2. ls -ltr python*
  3. ln -s /usr/local/bin/python2.7 /usr/local/bin/python

final check:

  1. sudo sh
  2. root@lg1:~ ] which python
  3. /usr/bin/python
  4. root@lg1:/home/0xdiag ] python
  5. Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
  6. [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
  7. root@lg1:~ ] exit
  8. sudo - user
  9. user@lg1:~ ] which python
  10. /usr/local/bin/python
  11. user@lg1:~ ] python
  12. Python 2.7.6 (default, Mar 19 2014, 22:45:29)
  13. [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
  14. Type "help", "copyright", "credits" or "license" for more information.

Installing and configuring distribute (setuptools)

After installing Python 2.7.6 you also need to install distribute (setuptools) so you can easily install new packages in the right location.

  1. wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
  2. sudo /usr/local/bin/python2.7 ez_setup.py
  3. sudo /usr/local/bin/easy_install-2.7 pip

The commands above will generate the script /usr/local/bin/easy_install-2.7. Use this script to install packages for your new Python version. You should be able to use "easy_install" if "which easy_install" points to the correct 2.7 versions 0xdiag@lg1:~ ] which pip /usr/local/bin/pip

  1. $ which easy_install
  2. /usr/local/bin/easy_install
  3. $ ls -ltr /usr/local/bin/easy_install*
  4. -rwxr-xr-x 1 root root 340 Jan 30 2013 /usr/local/bin/easy_install-2.7
  5. -rwxr-xr-x 1 root root 332 Jan 30 2013 /usr/local/bin/easy_install
  6. sudo /usr/local/bin/easy_install-2.7 requests
  7. sudo /usr/local/bin/easy_install-2.7 psutil
  8. sudo /usr/local/bin/easy_install-2.7 paramiko
  9. (for normal user, easy_install should work too, if your PATH gets /usr/local/bin first)

I had to rename pip and easy_install in /user/local/bin and create links. The existing ones were 2.6 variants i.e.

  1. cd /usr/local/bin
  2. mv pip pip2.6
  3. mv easy_install easy_install-2.6
  4. ln -s pip2.7 pip
  5. ln -s easy_install-2.7 easy_install

result in /usr/local/bin

  1. -rwxr-xr-x 1 root root 6214533 Mar 19 22:46 python2.7
  2. -rwxr-xr-x 1 root root 1674 Mar 19 22:46 python2.7-config
  3. lrwxrwxrwx 1 root root 24 Mar 19 22:51 python -> /usr/local/bin/python2.7
  4. -rwxr-xr-x 1 root root 323 Mar 19 23:18 easy_install-2.6
  5. -rwxr-xr-x 1 root root 331 Mar 19 23:18 easy_install-2.7
  6. -rwxr-xr-x 1 root root 296 Mar 19 23:22 pip2.7
  7. -rwxr-xr-x 1 root root 290 Mar 19 23:22 pip2.6
  8. -rwxr-xr-x 1 root root 292 Mar 19 23:22 pip2
  9. lrwxrwxrwx 1 root root 16 Mar 19 23:29 easy_install -> easy_install-2.7

result in /usr/bin

  1. ls -ltr /usr/bin/pip
  2. -rwxr-xr-x 1 root root 281 Oct 24 15:38 /usr/bin/pip
  3. ls -ltr /usr/bin/easy_install
  4. -rwxr-xr-x 1 root root 323 Nov 11 2010 /usr/bin/easy_install
 

[转]Installing python 2.7 on centos 6.3. Follow this sequence exactly for centos machine only的更多相关文章

  1. Installing Python Modules

    Email: distutils-sig@python.org As a popular open source development project, Python has an active s ...

  2. yum命令安装软件时,出现--centos 7 安装apache 出现 Could not resolve host: mirrorlist.centos.org; 未知的错误"--CentOS网络设置 couldn't resolve host 'mirrorlist.centos.org问题解决

    CentOS网络设置 couldn't resolve host 'mirrorlist.centos.org问题解决 今天在虚拟机上安装完CentOS6.5之后,首次使用时yum命令安装软件时,出现 ...

  3. Installing Python 3.5.2 from source

    Here are the procedures we are to follow, Download the source code of an official Python release. Co ...

  4. CentOS 7 安装配置KVM 通过KVM安装CentOS系统

    搭建环境 : CentOS 7 [root@KVM ~]# systemctl stop firewalld [root@KVM ~]# systemctl disable firewalld [ro ...

  5. CentOS 7.4 初次手记:第二章 CentOS安装步骤

    第二章 CentOS安装步骤... 18 第一节 下载... 18 第二节 分区参考... 18 第三节 安装... 19 I Step 1:引导... 19 II Step 2:配置... 20 I ...

  6. CentOS网络设置 couldn't resolve host 'mirrorlist.centos.org问题解决

    在VBox上安装完CentOS6.5之后,首次使用时yum命令安装软件时,经常遇到"couldn't resolve host 'mirrorlist.centos.org"这个问 ...

  7. CentOS部署NetCore - 2. 安装NetCore SDK On CentOS

    登录微软官网,进入Install .NET Core SDK on Linux CentOS / Oracle 按照对应的指令,安装SDK Install the .NET SDK Update th ...

  8. (二)给Centos配置网络以及使用xshell远程连接Centos

    好吧,我对网络协议以及ip配置知识的匮乏,让我在这里折腾了将近一天才搞定.可以说基本上网上遇到的问题我都遇到了.在这里,记下正确的步骤来给Centos配置网络.希望以后少走弯路. 首先我要说明的是,我 ...

  9. Learning Experience of Big Data: Connect CentOs to Xshell and set Java environment on CentOS

    1.set up connections between vitural machine and Xshell: After we connect the virtural machine to ne ...

随机推荐

  1. LinQ递归查询

    --由父项递归下级 with cte(refid,pid,zname,code) as (--父项 union all --递归结果集中的下级 select t.refid,t.pid,t.zname ...

  2. Javascript之Prototype

    1.原型设计模式 在.Net中可以使用clone()来实现原型法 原型法的主要思想是,现在有1个类A,我想要创建一个类B,这个类是以A为原型的,并且能进行扩展.我们称B的原型为A. 2.javascr ...

  3. c#关于日期的两个知识点

    1 C#中如何获得两个日期之间的天数差 DateTime d1;DateTime d2; int days = (d1 - d2).Days;//天数差 2 C#中从字符串得到DateTimeConv ...

  4. CKEditor使用配置方法

    一.使用方法: 1.在页面<head>中引入ckeditor核心文件ckeditor.js <script type="text/javascript" src= ...

  5. LintCode MinStack

    Implement a stack with min() function, which will return the smallest number in the stack. It should ...

  6. mysql 导入导出方法。

    1.导出  mysqldump -u username - p databasename >名.sql enter passward: 2.导入:mysql -uroot -proot sour ...

  7. HDU 5446 中国剩余定理+lucas

    Unknown Treasure Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Other ...

  8. Swift—继承

    一个类可以继承另一个类的方法,属性和其他特性.当一个类继承其他类时,继承类叫子类,被继承类叫超类(或父类).在Swift中,继承具有单继承的特点,每个子类只有一个直接父类,继承是区分类与其他类型的一个 ...

  9. Java学习

    第一个java程序: 用记事本创建一个文件名为HelloWorld.java文件,我的目录为D:\My Documents\Java-workspace\Test\HelloWorld.java. 打 ...

  10. unity官方换装教程Character Customization 学习笔记

    1. 下载示例demo,可以直接从AssetsStore上下载,但是速度比较慢,我在github上找了一个据说支持unity5.x的. 链接:https://github.com/spacebeagl ...