From 49e1fc46f4d6f629c28088747d6639dd6f86d186 Mon Sep 17 00:00:00 2001 From: Pierre Poulain Date: Tue, 15 Mar 2016 17:15:06 +0100 Subject: [PATCH 1/3] Add --user and --upgrade options --- cheat/cheatsheets/pip | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cheat/cheatsheets/pip b/cheat/cheatsheets/pip index edc122c..e5b5009 100644 --- a/cheat/cheatsheets/pip +++ b/cheat/cheatsheets/pip @@ -4,6 +4,12 @@ pip search SomePackage # Install some packages pip install SomePackage +# Install some package in user space +pip install --user SomePackage + +# Upgrade some package +pip install --upgrade SomePackage + # Output and install packages in a requirement file pip freeze > requirements.txt pip install -r requirements.txt From c0d755e1021f05970b445871cc38c53f64fc170d Mon Sep 17 00:00:00 2001 From: Pierre Poulain Date: Tue, 15 Mar 2016 17:28:07 +0100 Subject: [PATCH 2/3] Add virtualenv --- cheat/cheatsheets/virtualenv | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 cheat/cheatsheets/virtualenv diff --git a/cheat/cheatsheets/virtualenv b/cheat/cheatsheets/virtualenv new file mode 100644 index 0000000..63d3920 --- /dev/null +++ b/cheat/cheatsheets/virtualenv @@ -0,0 +1,15 @@ +# Create new environment +virtualenv /path/to/project/env_name + +# Create new environment and inherit already installed Python libraries +virtualenv --system-site-package /path/to/project/env_name + +# Create new environment with a given Python interpreter +virtualenv /path/to/project/env_name -p /usr/bin/python/3.4 + +# Activate environnment +source /path/to/project/env_name/bin/activate + +# Quit environment +deactivate + From c0585ee55cae621ad346845837cc03883eef3b80 Mon Sep 17 00:00:00 2001 From: Pierre Poulain Date: Tue, 15 Mar 2016 17:34:28 +0100 Subject: [PATCH 3/3] Append virtualenvwrapper commands --- cheat/cheatsheets/virtualenv | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/cheat/cheatsheets/virtualenv b/cheat/cheatsheets/virtualenv index 63d3920..a0fb6d4 100644 --- a/cheat/cheatsheets/virtualenv +++ b/cheat/cheatsheets/virtualenv @@ -13,3 +13,26 @@ source /path/to/project/env_name/bin/activate # Quit environment deactivate + +# virtualenvwrapper (wrapper for virtualenv) +# installation +pip install --user virtualenvwrapper +# configuration +# add in ~/.bashrc or similar +export WORKON_HOME=~/.virtualenvs +mkdir -p $WORKON_HOME +source ~/.local/bin/virtualenvwrapper.sh + +# Create new environmment (with virtualenvwrapper) +mkvirtualenv env_name +# new environmment is stored in ~/.virtualenvs + +# Activate environmment (with virtualenvwrapper) +workon env_name + +# Quit environmment (with virtualenvwrapper) +deactivate + +# Delete environmment (with virtualenvwrapper) +rmvirtualenv env_name +