Creating Virtual Environment: My Wholesome Guide to Learning Python
A simple python project can just be as simple as a single python file, and you can see in the different python files that I have written in the different blog posts like part1, part2 or part3.
But, think of your python project being complex, such as making a request to get photos, calculating your income or saving data into the database. These are different things, and you can’t focus on getting everything written down as you might be busy in trying to get awesome cool new feature out the door. So, why not use the tools and libraries other amazing software engineers have already made for you? That is where virtual environment comes in.
For each project, you can have a virtual environment where only the libraries of that project will be part of the project.
It is really simple to actually create a virtual environment
Create a virtual environment
python -m venv virtualenv
Use that virtual environment on Mac & Linux, bash
$ source virtualenv/bin/activate # for bash, linux, mac
And for windows
D:\dev> virtualenv\Scripts\activate.bat
Verify that virtual environment is activated
To verify that the virtualenv is activated, you will see something like this
(venv) D:\dev>