Skip to content

Instantly share code, notes, and snippets.

@jmvrbanac
Last active September 2, 2016 01:51
Show Gist options
  • Save jmvrbanac/c7bd0bda105810a1cf7f to your computer and use it in GitHub Desktop.
Save jmvrbanac/c7bd0bda105810a1cf7f to your computer and use it in GitHub Desktop.
Custom pip index per virtualenv (using virtualenvwrapper)
#!/bin/bash
# This hook is sourced after every virtualenv is activated.
# This belongs in $WORKON_HOME/postactivate
VIRTUAL_ENV_NAME=${VIRTUAL_ENV##*/}
if [[ $VIRTUAL_ENV_NAME == *"custom_prefix_"* ]]
then
export PIP_INDEX_URL="https://pypi.python.org/simple"
else
# Put this line in postdeactivate as well
unset PIP_INDEX_URL
fi
#!/bin/bash
# This hook is sourced after every virtualenv is deactivated.
unset PIP_INDEX_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment