Skip to content

Instantly share code, notes, and snippets.

@melvinlee
Last active April 29, 2018 04:53
Show Gist options
  • Select an option

  • Save melvinlee/699e043daf758324c256b44aae5a8d35 to your computer and use it in GitHub Desktop.

Select an option

Save melvinlee/699e043daf758324c256b44aae5a8d35 to your computer and use it in GitHub Desktop.
Python virtualenv

Create VirtualEnv

$ cd ~/.virtualenvs
$ virtualenv <projectname>
Using base prefix '/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/melvinlee/.virtualenvs/lambda-digitalgift/bin/python3.6
Also creating executable in /Users/melvinlee/.virtualenvs/lambda-digitalgift/bin/python
Installing setuptools, pip, wheel...done.

Activate VirtualEnv

$ . <project>/bin/activate
project $

Exiting VirtualEnv

project $ deactivate

Using VirtualEnv Wrapper

Setup new virtualenv for exisiting project

$ mkdir <project>
$ cd <project>
$ mkvirtualenv <project>
$ setvirtualenvproject

From scratch

Create a project and virtualenv (bind them)

$ mkproject <project>

Activate virtualenv

$ workon <project>
project $

Remove virtualenv

$ rmvirtualenv <project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment