~2 min read • Updated Feb 4, 2026
1. What Is a Python Virtual Environment?
A Virtual Environment is an isolated environment that allows a Python project to have its own dependencies, libraries, and Python version without affecting other projects or the system-wide installation.
This approach helps prevent version conflicts and ensures project stability.
2. Creating a Virtual Environment with a Specific Python Version
You can create virtual environments using different installed Python versions.
py -3.14 -m venv myenvThe command above creates a virtual environment named myenv using Python 3.14.
py -3.13 -m venv oldenvThis command creates another environment using Python 3.13.
3. Activating the Virtual Environment on Windows
After creating the environment, it must be activated.
C:\Users\python\Desktop\myenv\Scripts>activateOnce activated, the environment name appears at the beginning of the terminal:
(myenv) C:\Users\python\Desktop\myenv\Scripts>4. Checking Python and pip Versions
To check the active Python version:
py -VTo check the installed pip version:
pip -V5. Updating pip to the Latest Version
To upgrade pip inside the virtual environment:
python -m pip install --upgrade pip6. Listing Installed Packages
To view all installed packages in the environment:
pip listTo export installed packages to a file:
pip freeze > package.txtThis file can be used to recreate the environment on another system.
7. Installing Django in the Virtual Environment
To install the latest version of Django:
pip install djangoTo install a specific version of Django:
pip install django==5.0.3Verify the installed Django version:
django-admin --version8. Creating a Django Project
To create a new Django project:
django-admin startproject myprojectNavigate into the project directory:
cd myproject9. Running the Django Development Server
To start the Django development server:
python manage.py runserverThe project will be available at the following address:
http://127.0.0.1:8000/Conclusion
Using a Python Virtual Environment allows developers to safely manage dependencies, Python versions, and frameworks such as Django. This workflow is essential for building scalable, portable, and professional Python projects.
Written & researched by Dr. Shahin Siami