Skip to content

Instantly share code, notes, and snippets.

@cthoyt
Created April 28, 2017 19:04
Show Gist options
  • Save cthoyt/c97536c3b85518c9e41e379507be48ee to your computer and use it in GitHub Desktop.
Save cthoyt/c97536c3b85518c9e41e379507be48ee to your computer and use it in GitHub Desktop.
Programatically use pip
# Pip is actually a python package!
import pip
# It's screwy and not really written to be used this way, but we still can
pip_install_cmd = pip.commands.InstallCommand()
# load up all the args you'd use after pip install and away we go!
args = ['--upgrade', '--user', 'requests']
pip_install_cmd.main(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment