Install python on Redhat based os without breaking yum / 28 Sep 2015 / Author: Haim Ari

    Estimated read time: 1 min

    Here is how you can safely install python from source:

    First, download and install the following packages:

    yum groupinstall "Development tools"
    yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel
    

    Python-2.7.10

    wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
    tar xf Python-2.7.10.tar.xz
    cd Python-2.7.10
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    make && make altinstall
    

    Now get the setup script for Setuptools:

    get-pip.py

    wget https://bootstrap.pypa.io/get-pip.py
    

    Then install it for Python 2.7 and/or Python 3.3:

    python2.7 get-pip.py
    

    Now install pip using the newly installed setuptools:

    easy_install-2.7 pip