Skip to content

Instantly share code, notes, and snippets.

@soasme
Forked from andriisoldatenko/install_python.sh
Created May 17, 2017 00:23
Show Gist options
  • Select an option

  • Save soasme/6bd7315f2380915506914301b3c9f522 to your computer and use it in GitHub Desktop.

Select an option

Save soasme/6bd7315f2380915506914301b3c9f522 to your computer and use it in GitHub Desktop.

Revisions

  1. Andrii Soldatenko revised this gist Aug 7, 2015. No changes.
  2. Andrii Soldatenko revised this gist Aug 7, 2015. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions install_python.sh
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,7 @@ TMP_PATH=~/tmp_install_python
    PYTHON_MAJOR=2.7
    PYTHON_VERSION=$PYTHON_MAJOR.10

    mkdir $TMP_PATH
    cd $TMP_PATH
    mkdir $TMP_PATH && cd $TMP_PATH

    # Update yum and libraries
    yum -y update
    @@ -31,5 +30,7 @@ cd $TMP_PATH

    # Finish installation
    rm -rf $TMP_PATH
    ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
    ln -sf /usr/local/bin/pip /usr/bin/pip
    ln -s /usr/local/bin/python2.7 /usr/local/bin/python
    ln -s /usr/local/bin/pip /usr/bin/pip

    pip install virtualenv
  3. @F1ashhimself F1ashhimself revised this gist Aug 6, 2015. 1 changed file with 8 additions and 10 deletions.
    18 changes: 8 additions & 10 deletions install_python.sh
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,6 @@ TMP_PATH=~/tmp_install_python
    # Versions section
    PYTHON_MAJOR=2.7
    PYTHON_VERSION=$PYTHON_MAJOR.10
    SETUPTOOLS_VERSION=18.1

    mkdir $TMP_PATH
    cd $TMP_PATH
    @@ -15,23 +14,22 @@ yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel

    # Download and extract Python and Setuptools
    wget --no-check-certificate https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
    wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-$SETUPTOOLS_VERSION.tar.gz
    wget --no-check-certificate https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
    wget --no-check-certificate https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
    tar -zxvf Python-$PYTHON_VERSION.tgz
    tar -xvf setuptools-$SETUPTOOLS_VERSION.tar.gz

    # Compile Python
    cd $TMP_PATH/Python-$PYTHON_VERSION
    ./configure --prefix=/usr/local
    make && make altinstall
    export PATH="/usr/local/bin:$PATH"

    # Install Setuptools
    cd $TMP_PATH/setuptools-$SETUPTOOLS_VERSION
    $PYTHON_MAJOR setup.py install

    # Download and install PIP
    curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python$PYTHON_MAJOR -
    # Install Setuptools and PIP
    cd $TMP_PATH
    /usr/local/bin/python$PYTHON_MAJOR ez_setup.py
    /usr/local/bin/python$PYTHON_MAJOR get-pip.py

    # Finish installation
    rm -rf $TMP_PATH
    ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
    ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
    ln -sf /usr/local/bin/pip /usr/bin/pip
  4. @F1ashhimself F1ashhimself created this gist Aug 6, 2015.
    37 changes: 37 additions & 0 deletions install_python.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    TMP_PATH=~/tmp_install_python

    # Versions section
    PYTHON_MAJOR=2.7
    PYTHON_VERSION=$PYTHON_MAJOR.10
    SETUPTOOLS_VERSION=18.1

    mkdir $TMP_PATH
    cd $TMP_PATH

    # Update yum and libraries
    yum -y update
    yum groupinstall -y development
    yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel

    # Download and extract Python and Setuptools
    wget --no-check-certificate https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
    wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-$SETUPTOOLS_VERSION.tar.gz
    tar -zxvf Python-$PYTHON_VERSION.tgz
    tar -xvf setuptools-$SETUPTOOLS_VERSION.tar.gz

    # Compile Python
    cd $TMP_PATH/Python-$PYTHON_VERSION
    ./configure --prefix=/usr/local
    make && make altinstall
    export PATH="/usr/local/bin:$PATH"

    # Install Setuptools
    cd $TMP_PATH/setuptools-$SETUPTOOLS_VERSION
    $PYTHON_MAJOR setup.py install

    # Download and install PIP
    curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python$PYTHON_MAJOR -

    # Finish installation
    rm -rf $TMP_PATH
    ln -sf /usr/local/bin/python2.7 /usr/local/bin/python