
So let’s do that… Step 1: Creating the Virtual Environment With those things in place, now you are ready to install and activate a Python3 virtual environment using venv in Windows, Linux, and macOS. If you satisfy all those 3 conditions, then you can head on to creating the virtual environment, Otherwise please do them first then continue. You don’t have to worry about this if you are using the latest version of Python. You should have added Python to your environment PATH variable.


So Before moving forward please satisfy the following requirements then only continue: Fortunately, venv is included by default in Python 3.4 and greater. If you are using a newer version of Python, then venv module is the preferred way to create and manage virtual environments. There are so many ways you can create a virtual environment by using different python modules like:īut the one we are going to use is the venv module. It’s always a good practice to create a new virtual environment for every new Python project you work on. Thus we can safely work on our project at any time without any worry! Got that? So your ProjectOne can use Django 1.0 in its own environment and ProjectTwo can work in Django 3.0. If you set up a virtual environment for both of your projects, then each project and all its dependencies would be isolated from each other in its own virtual environment and both won’t get mingled. And here’s where the concept of virtual environment comes in handy. How would you do that? If you install Django globally on your system, then it would be impossible to satisfy the above condition.

Unfortunately, your ProjectOne wants to run in Django 1.0, and your ProjectTwo needs Django 3.0. To make it a bit clearer imagine this scenario - you have two Django projects namely ProjectOne and ProjectTwo. This post was originally published on my blog - Ī virtual environment is a tool that helps to keep your current project and all its dependencies isolated from your main system and the other projects you are working on.
