The Isolated Serpent
Virtual Environments In Python

Python got Virtual Environment ?
Yup. Python doesn’t just run code—it builds chambers for it. These chambers are called virtual environments, and they help isolate your project from the chaos of the outside system.
In Python, you can:
Create a virtual environment using
python -m venv <name>Activate it to step inside the chamber
Install libraries without polluting your system
Run your code in peace, then deactivate when done
It’s like building a glass terrarium for your code—everything inside is yours to control, and nothing leaks out.
So, How can I create and start working with Virtual Environment In Python ?
Virtual Environment Creation By Command Prompt In Windows:
Open Command Prompt
Go To Folder Location
cd /d "<folder_location>"Setup and create Python Interpreter and Environment
python -m venv <environment_name>OR
py -<python_version> -m venv <environment_name>Activate the Virtual Environment
.\<same_environment_name>\Scripts\activateYou can also install isolated libraries in that as follows:
pip install <package_name>File creation method are shown in below topics, write some code, save your changes, and close the file.
After working you can deactivate the Environment by:
deactivate
Directly closing an activated Virtual Environment will lead to deactivating it, but it is considered better practice to deactivate it manually.
Critical Adjustments to Encounters
In Windows, a security protocol prevents scripts from manipulating the internal workings of the computer. As a result, it becomes necessary to bypass this security protocol as follows:
Temporary Fix (Instance Based):
Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassSafer Fix (Directory Based)
Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassPermanent Fix (User Based)
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
🧱 Where to Create Files (and src/)
You’ve already activated the virtual environment using:
.\<environment_folder_name>\Scripts\activate
Now, do not place your code inside environment_folder_name/. That folder is sacred—it holds the chamber’s internals.
Instead, create your
src/folder next toenvironment_folder/, like this:
<parent-folder>/
├── <virtual_environment_folder>/ ← virtual environment (don’t touch)
├── src/ ← your code lives here
│ └── <file_x>.py
└── <or_file_y>.py ← or even in parent-folder itself
You can run your script like this:
python <file_name>.py
OR
python .\<file_name>.py
And since your virtual environment is activated, any
pip installwill go intoenvironment_name/Lib/site-packages, safely isolated.
