Skip to content

Instantly share code, notes, and snippets.

@chrislkeller
Last active March 9, 2019 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrislkeller/a717e76d53c3054dc903807625523d86 to your computer and use it in GitHub Desktop.
Save chrislkeller/a717e76d53c3054dc903807625523d86 to your computer and use it in GitHub Desktop.
Setting up a virtualenv

Setting up a virtualenv

  • Install virtualenv

    pip install virtualenv

  • I believe in installing virtualenvwrapper as well

    pip install virtualenvwrapper

  • Edit your ~/.bash_profile file again

    nano ~/.bash_profile

  • Add this line

    source /usr/local/bin/virtualenvwrapper_lazy.sh

Save and exit out of nano using control + O, enter, and then control + X.


Here let's crib from NPR Apps How to Setup Your Mac to Develop News Applications Like We Do

  • virtualenv creates the actual environment that you’ll be using, while virtualwrapper makes the interface to these virtual environments even simpler.

If you installed virtualenvwrapper:

  • Create a virtualenv to store the codebase mkvirtualenv name-of-virtualenv

  • Activate the virtualenv workon name-of-virtualenv

  • Exit out of the virtual environment, run:

    deactivate

  • Delete the virtual

    rmvirtualenv name-of-virtualenv

If you didn't install virtualenvwrapper:

  • Change into your code directory

    cd name-of-directory

  • Create a virtualenv to store the codebase

    virtualenv name-of-virtualenv

  • Change into your virtualenv directory

    cd name-of-virtualenv

  • Activate the virtualenv

    . bin/activate

  • Move back one level to the code directory

    cd ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment