Skip to content

Instantly share code, notes, and snippets.

@victorono
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save victorono/8813af2b1dcdbe1f92c3 to your computer and use it in GitHub Desktop.

Select an option

Save victorono/8813af2b1dcdbe1f92c3 to your computer and use it in GitHub Desktop.
Using a local cache for pip packages
# edit your .bashrc
nano ${HOME}/.bashrc
if [ ! -d "${HOME}/.pip-packages" ]; then
mkdir ${HOME}/.pip-packages
fi
alias pipcache='pip install --download ${HOME}/.pip-packages'
alias pipinstall='pip install --no-index --find-links=file://${HOME}/.pip-packages/'
# The first downloads the packages to my local cache, the second installs them from the cache.
# Usage is probably fairly obvious:
pipcache Django==1.7 # Put Django-1.7-py2.py3-none-any.whl in ~/.pip-packages
pipinstall Django==1.7 # Install ~/.pip-packages/Django-1.7-py2.py3-none-any.whl
pipcache -r requirements.txt # Cache all the requirements of a project
pipinstall -r requirements.txt # Install all requirements from the cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment