-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
Introduction to Python
Python Basics
Python Syntax
Python Comments
Python Variables
Python Data Types
Python Casting
Python I/O
Python Operators
Cotrol Structures
Data Structures
Python Strings
Python Lists
Python Tuples
Python Dictionaries
Python Sets
Python Arrays
Python Bytes and Bytearray
Date and Time
Functions and Module
File Handling
Python OOP
Advanced Concepts
Python Scope
Python Modules
Python JSON
Python RegEx
Python PIP
Python Try...Except
Python String Formatting
Python User Input
Python VirtualEnv
Python Math
Python DSA
Python DSA
Lists and Arrays
Python Stacks
Python Queues
Linked Lists
Python Hash Tables
Python Trees
Python Binary Trees
Binary Search Trees
Python AVL Trees
Python Graphs
Searching Algorithms
Sorting Algorithms
A Virtual Environment in Python is a self-contained directory that contains a Python installation for a specific project. It keeps dependencies isolated from your global Python setup.
Prevents dependency conflicts between projects
Keeps your project environment clean and manageable
Lets you use different versions of packages for different projects
Use the built-in venv
module:
python -m venv myenv
✅ This will create a folder named myenv
with the virtual environment inside it.
myenv\Scripts\activate
source myenv/bin/activate
✅ Once activated, your terminal will show the environment name like:(myenv) C:\Users\...>
Now that you're inside the virtual environment, use pip
as usual:
pip install flask
The installed packages stay isolated from your system Python.
When you're done:
deactivate
✅ You’ll exit the virtual environment and return to your global Python path.
Just delete the folder:
rm -r myenv
pip list
You’ll only see packages installed within that environment.
Q1. Write a Python command to create a virtual environment called projectenv
.
Q2. Write a command to activate the virtual environment on Windows.
Q3. Write a command to install the django
package inside the virtual environment.
Q4. Write a command to list all installed packages inside the virtual environment.
Q5. Write a command to deactivate the virtual environment.
Q6. Write a command to create a requirements.txt
file using pip freeze
.
Q7. Write a command to install dependencies from requirements.txt
inside a virtual environment.
Q8. Write a command to delete a virtual environment folder named projectenv
.
Q9. Write a short explanation or command to use a virtual environment to avoid package conflicts.
Q10. Write steps to use different versions of the same package in two separate virtual environments.
Introduction to Python
Python Basics
Python Syntax
Python Comments
Python Variables
Python Data Types
Python Casting
Python I/O
Python Operators
Cotrol Structures
Data Structures
Python Strings
Python Lists
Python Tuples
Python Dictionaries
Python Sets
Python Arrays
Python Bytes and Bytearray
Date and Time
Functions and Module
File Handling
Python OOP
Advanced Concepts
Python Scope
Python Modules
Python JSON
Python RegEx
Python PIP
Python Try...Except
Python String Formatting
Python User Input
Python VirtualEnv
Python Math
Python DSA
Python DSA
Lists and Arrays
Python Stacks
Python Queues
Linked Lists
Python Hash Tables
Python Trees
Python Binary Trees
Binary Search Trees
Python AVL Trees
Python Graphs
Searching Algorithms
Sorting Algorithms