Category Archives: python

install python2.7 on Redhat with software collections (rhscl)

RHEL 6 contains a system installation of python 2.6.

If you want to use another version of python e.g. python 2.7 you have a number of options:

build the standard python distribution from source

  • see an example installation
  • it can be customised to include/exclude the features needed
  • but it does not contain the fixes and tweaks added by the OS vendor

build an rpm from source

use the prebuilt rpms from “Redhat software collections”

  • Redhat provides a way to install newer versions of Python, Ruby, … that do not interfere with the official distributions
  • more installation information here and here
  • general information about Software Collections: redhat blog
  • those instructions use a test-repo, the supported RHAT channel can be enabled with: ‘rhn-channel –add –channel=rhel-x86_64-server-6-rhscl-1′ (not tested yet)
  • it uses a separate RPM repo. If it the repo is not enabled, a system upgrade does not automatically upgrade these packages.
  • if you want to use python 2.7 as a default in your session, execute the command ‘source /opt/rh/python27/enable’

People debugger

A prod of a Monday morning idle brain. It goes like this:

from interfaces import IMakeSense

def getSense(person):
    """ Simple people debug tool """
    if IMakeSense.providedBy(person):
        return None

This can be useful in combination with a default method, something like:

def Default(person):
    alsoProvides(person, IMakeNonsense)
    return True