developers' network - quick start guides to bootstrap examples

(Perfect for people with a short attention span, needing to get work done!)

Interpreter vs virtualenv

Why use virtual environments instead of an interpreter?

A virtual environment "clones" an interpreter, but doesn't make broad changes.

Use an interpreter if you're only running simple code that doesn't require any additional modules.

You can easily swap an interpreter and a virtual environment, especially when you use pyenv; which is what most of these Python-related guides are geared towards.

Consider the following: a Computer Vision application might require a large amount of modules (e.g. transformation, analysis, correction, followed by data storage and analysis) while as a Django application might only require a single module (e.g. Django, and that's it.)

Rather than bogging down a Python interpreter with all of these packages which may also conflict with each other (e.g. there are multiple modules that erroneously import as "magic"[a] [b], even though they serve different purposes), these can be separated out into individual virtual environments. So, if you were to run both on Python 3, then your pyenv versions list would resemble:

  • system
  • 3.5.2
  • myComputerVisionEnv
  • myDjangoEnv