Search code examples
pythonlinuxrhelsuse

On linux SUSE or RedHat, how do I load Python 2.7


Can someone provide the steps needed to install python version 2.7 on SUSE and RedHat? It version that is on there is like 2.4 and I need to have it at at least 2.6 to make my script work. So after the install, I can type Python in a xTerm and get the Python 2.7 command line interface.


Solution

  • Instructions to download source and install:

    https://www.python.org/download/

    NOTE: You should check for the latest version of python 2.7.x, as it gets updated frequently. Currently (Oct 2017), the latest version is 2.7.14 though this comment will get old and new versions likely will be released every 6 months or so.

    wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz # Download
    tar xvfz Python-2.7.14.tgz # unzip
    cd Python-2.7.14 # go into directory
    ./configure
    make # build
    su # or 'sudo su' if there is no root user
    make altinstall
    

    (EDIT: make install -> make altinstall per Ignacio's comment).