Setting up a virtual environment

A virtual environment is the way Python isolates full package environments from one another. This means you can easily manage dependencies. Imagine you want to define the minimum necessary packages for a project; a virtual environment would be perfect to let you test and export the list of needed packages. We will discuss it later on. Now, create a new terminal pressing Ctrl + Shift + T on your keyboard and create our hello world environment like this:

mkvirtualenv hello
pip install flask

The first line creates our environment with the name "hello". You will also automatically load that environment into the current terminal. You can deactivate your virtual environment by typing deactivate and you can load it again ...

Get Building Web Applications with Flask now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.