Skip to content

Instantly share code, notes, and snippets.

@danielecook
Last active October 26, 2015 16:55
Show Gist options
  • Save danielecook/1c22df26f64e35030853 to your computer and use it in GitHub Desktop.
Save danielecook/1c22df26f64e35030853 to your computer and use it in GitHub Desktop.
Install python + easy_install + pip locally
# Python 2
mkdir ~/python2
cd ~/python2
wget http://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar zxfv Python-2.7.10.tgz
find ~/python2 -type d | xargs chmod 0755
cd Python-2.7.10
./configure --prefix=$HOME/python2
make
make install
ln -s ~/python2/Python-2.7.10/python ~/python2/bin/python2.7
# Use python2 as standard python.
export PATH=$HOME/python2/Python-2.7.10:$PATH
# easy_install
wget http://peak.telecommunity.com/dist/ez_setup.py
mkdir -p ~/python2/lib/python2.7/site-packages/
export PYTHONPATH=~/python2/lib/python2.7/site-packages/
./python ez_setup.py
# pip
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
python get-pip.py
alias pip2="~/python2/Python-2.7.10/python -m pip install"
export PATH=$HOME/python2/bin:$PATH
# Python 3
mkdir ~/python3
cd ~/python3
wget http://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
tar zxfv Python-3.4.3.tgz
find ~/python3 -type d | xargs chmod 0755
cd Python-3.4.3
./configure --prefix=$HOME/python3
make
make install
export PATH=$HOME/python3/Python-3.4.3:$PATH
# pip
alias pip3="~/python3/bin/pip"
alias easy_install3="~/python3/bin/easy_install3.4"
# Add to bash_config
export PATH=$HOME/python2/Python-2.7.10:$PATH
alias python2="~/python2/Python-2.7.10/python"
alias pip="python2 -m pip"
alias pip2="python2 -m pip"
alias easy_install2="~/python2/bin/easy_install-2.7"
alias python3="~/python3/Python-3.4.3/python"
alias pip3="~/python3/Python-3.4.3/python -m pip"
alias easy_install3="~/python3/bin/easy_install-3.4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment