Last Updated: February 25, 2016
·
1.136K
· ronelliott

Helpful Bash Aliases for Pip

Here are some helpful aliases for bash that will make your fingers not hate you as much:

alias pir="pip install -r requirements.txt"
alias pip-upgrade-all="pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs pip install -U"

pip_freeze() {
    echo "Freezing to 'requirements.txt'"
    pip freeze > requirements.txt
}

pip_install() { pip install $@ }

pip_uninstall() { pip uninstall -y $@ }

pip_install_freeze() { pip_install $@ && pip_freeze }

pip_uninstall_freeze() { pip_uninstall $@ && pip_freeze }

alias pi='pip install'
alias pif=pip_install_freeze
alias pf=pip_freeze

alias pu='pip uninstall -y'
alias puf=pip_uninstall_freeze

Github
They can also be found in gist form here:
https://gist.github.com/ronelliott/5182246

Install
There are a few options here so you can pick which suits you best:

  • Copy the code above into a file in your home directory and source it in your .bashrc / .bash_profile

  • Copy the code above directly into your .bashrc / .bash_profile

  • Clone the gist to a file in your home directory and source it in your .bashrc / .bash_profile