How to Create a Virtual Environment - ZamaZoe/1.-Kurro-REST-API-Tutorial_Introduction GitHub Wiki
Introduction
Welcome!
Before building our REST API tutorial project, we must create and activate a virtual environment for our project.
What is a virtual environment?
A virtual environment, commonly called 'venv
,' is a built-in Python module that serves as a tool that helps manage and isolate dependencies for different projects. It allows developers to create a self-contained environment to install and run specific versions of libraries and packages without affecting the global Python environment.
You must activate a virtual environment to make your PowerShell or command prompt an interactive Python environment. Once activated, your shell prompt will change to show that you have switched from the system-wide installation and are now working in the virtual environment. Likewise, after working with a specific environment, you can deactivate it and return to the global Python environment.
There are a variety of tools available that you can use to create a virtual environment, including:
- You can use 'venv,' a built-in module in Python 3.3 and newer versions of Python.
- You can use 'virtualenv,' a third-party module installed using a pip package.
- You can use Conda (for managing environments with the Anaconda distribution).
- In this tutorial, we will use the Python built-in module 'venv' to create our virtual environment. Here are the steps to create a virtual environment:
The Steps to Create and Activate a Virtual Environment
- Enter the following command