- A virtual environment is the most used tool by the developers to isolate the dependencies for different projects.
- Suppose you have two projects say porj1 and proj2. proj1 needs the Django dependency with version 3.2 but your proj2 needs the Django dependency with version 2.2. In this situation you need a virtual environment to keep the both version on your system separately.
How to create virtual environment in python:
- Decide a directory where you want to create the virtual environment. You can use your project directory or any other directory as per your wish.
- Run the below command. Here`awesome_proj_env` is the folder where virtual environment will be created. if the folder does not exists then it will be created automatically.
- python3 -m venv awesome_proj_env
- On Linux/Mac OSX:
- source awesome_proj_env/bin/activate