Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Python 2.7.9 on Ubuntu 14.04.2 (without overwriting original version)
#! /usr/bin/env bash
# install dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
sudo apt-get install checkinstall
# download and extract python 2.7.9 source
mkdir ~/source
cd ~/source
tar -xvf Python-2.7.9.tgz
sudo mv Python-2.7.9 python-current
#cd Python-2.7.9
cd python-current
# compile python source to new directory
sudo mkdir /opt/python-current
./configure --prefix=/opt/python-current
# use checkinstall to create and install deb package
sudo checkinstall --pkgname python-current
# display python version
/opt/python-current/bin/python -V
# install setuptools
curl -o - | sudo /opt/python-current/bin/python
# use setuptools to install pip
sudo /opt/python-current/bin/easy_install -s /opt/python-current/bin -d /opt/python-current/lib/python2.7/site-packages/ pip
# update PATH to include the new version of python first
export PATH="/opt/python-current/bin:$PATH"
# package can then be removed with:
# sudo dpkg -r python-2.7.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.