This website collects cookies to deliver better user experience
Virtual Environment walkaround and Flask installation
Virtual Environment walkaround and Flask installation
Imagine you live in your 1 room big house having the size of 40 feet by 50 feet. The house doesn't have any separate rooms and you live with your family. You want to make a video of yours practising playing guitar but you aren't able to follow the metronome ticks due to the distractions of the people moving in front of you.
What would be the viable solution to carry out the passion of playing guitar or recording it?
You might move to a separate room. But to construct a separate room it would put a dent on your wallet. How about you cordon off a small area with curtains? That would be feasible as well as it would help you in cutting off the distractions and you could carry on with your passion of playing the guitar and mastering it.
Virtual environment works in the same manner like the makeshift guitar practising room.
You could install packages and libraries and work on your projects without impacting the global environment.
To get started let's dive in ...
Open Terminal
Select the drive you want work on (Eg : I would be selecting Desktop)
cd Desktop
Create the directory (Eg : The directory created is Project)
mkdir Project
Get inside the Project folder
cd Project
Install the Virtual environment (Eg : 'project_env' as Virtual environment)
python3 -m venv Project_env
List out all the files in the Project folder
ls
List out all the packages which are installed
pip freeze
Activate the virtual environment
source project_env/bin/activate
The name of the Virtual environment comes in front after it's activation
Install a Python library say Flask
pip install flask
After Installation
Verifying the proper Installation
python
import flask
If no errors are shown then it means that the module has been installed correctly.