Skip to content

Instantly share code, notes, and snippets.

@towens
Forked from andriisoldatenko/install_python.sh
Last active December 1, 2017 07:26
Show Gist options
  • Select an option

  • Save towens/2f8bc99e7bc2956882357e38f108ba86 to your computer and use it in GitHub Desktop.

Select an option

Save towens/2f8bc99e7bc2956882357e38f108ba86 to your computer and use it in GitHub Desktop.

Revisions

  1. towens revised this gist Dec 1, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions install_python27x.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ TMP_PATH=~/tmp_install_python

    # Versions section
    PYTHON_MAJOR=2.7
    PYTHON_VERSION=$PYTHON_MAJOR.12
    PYTHON_VERSION=$PYTHON_MAJOR.14

    rm -rf $TMP_PATH
    mkdir $TMP_PATH
    @@ -14,21 +14,21 @@ cd $TMP_PATH
    # cd openssl-1.1.0g
    # ./config
    # make && make install

    cd $TMP_PATH
    #cd $TMP_PATH

    # Update yum and libraries
    yum -y update
    yum groupinstall -y development
    yum install -y zlib zlib-dev openssl-devel sqlite-devel bzip2-devel openssh openssl openssl-devel
    yum install -y ncurses-devel readline-devel tk-devel zlib zlib-dev openssl-devel \
    sqlite-devel bzip2-devel openssh openssl openssl-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel wget

    # Download and extract Python and Setuptools
    wget --no-check-certificate https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
    tar -zxvf Python-$PYTHON_VERSION.tgz

    # Compile Python
    cd $TMP_PATH/Python-$PYTHON_VERSION
    ./configure --prefix=/usr/local
    ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    make && make altinstall
    export PATH="/usr/local/bin:$PATH"

  2. towens renamed this gist Dec 1, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. towens revised this gist Dec 1, 2017. 1 changed file with 21 additions and 6 deletions.
    27 changes: 21 additions & 6 deletions install_python.sh
    Original file line number Diff line number Diff line change
    @@ -4,12 +4,23 @@ TMP_PATH=~/tmp_install_python
    PYTHON_MAJOR=2.7
    PYTHON_VERSION=$PYTHON_MAJOR.12

    mkdir $TMP_PATH && cd $TMP_PATH
    rm -rf $TMP_PATH
    mkdir $TMP_PATH
    cd $TMP_PATH

    # openssl dance
    # wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.0g.tar.gz
    # tar -zxvf openssl-1.1.0g.tar.gz
    # cd openssl-1.1.0g
    # ./config
    # make && make install

    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
    yum install -y zlib zlib-dev openssl-devel sqlite-devel bzip2-devel openssh openssl openssl-devel

    # Download and extract Python and Setuptools
    wget --no-check-certificate https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
    @@ -23,9 +34,7 @@ export PATH="/usr/local/bin:$PATH"

    # Install Setuptools and PIP
    cd $TMP_PATH
    wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
    wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
    /usr/local/bin/python$PYTHON_MAJOR ez_setup.py
    wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
    /usr/local/bin/python$PYTHON_MAJOR get-pip.py

    # Finish installation
    @@ -35,5 +44,11 @@ rm /usr/bin/pip
    ln -s /usr/local/bin/pip /usr/bin/pip

    pip install virtualenv
    pip install setuptools
    cd
    rm -rf $TMP_PATH
    rm -rf $TMP_PATH



    # reload shell after adding $USER to docker group
    exec $SHELL
  4. towens revised this gist Dec 1, 2017. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions install_python.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ TMP_PATH=~/tmp_install_python

    # Versions section
    PYTHON_MAJOR=2.7
    PYTHON_VERSION=$PYTHON_MAJOR.10
    PYTHON_VERSION=$PYTHON_MAJOR.12

    mkdir $TMP_PATH && cd $TMP_PATH

    @@ -13,8 +13,6 @@ 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://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

    # Compile Python
    @@ -25,12 +23,17 @@ export PATH="/usr/local/bin:$PATH"

    # Install Setuptools and PIP
    cd $TMP_PATH
    wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
    wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
    /usr/local/bin/python$PYTHON_MAJOR ez_setup.py
    /usr/local/bin/python$PYTHON_MAJOR get-pip.py

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

    pip install virtualenv
    pip install virtualenv
    cd
    rm -rf $TMP_PATH
  5. Andrii Soldatenko revised this gist Aug 7, 2015. No changes.
  6. 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
  7. @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
  8. @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