Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing inEnroll Now
What is a Virtual Environment?
As the name suggests, it is an environment virtually created to isolate the projects.
This isolation helps to avoid discrepancies between the different versions of the libraries or packages as used by different projects in our system.
Why do we use a Virtual Environment?
How to create a Virtual Environment?
Creating a Virtual Environment: We create a python3 virtual environment with the name we mention using the following command:
virtualenv -p python3 <<your virtual environment name>>
Ex: virtualenv -p python3 my_first_venv creates a virtual environment named my_first_venv.
Activating a Virtual Environment: After creating the virtual environment, we switch to that environment to create our project and install the dependencies inside that environment. We switch to a virtual environment using the following command:
source <<your virtual environment name>>/bin/activate
Ex: source my_first_venv/bin/activate command switches to the virtual environment named my_first_venv.
Deactivating a Virtual Environment: To exit the environment, we just need to use the command:
First, switch to Python 3
Now, create a virtual environment named
virtualenv -p python3 Dead-Code-Sample
Activate the virtual environment you created
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here