Close Menu
DPC Virtual Tips
    Read More

    Linux Commands to Investigate High Disk Partition Usage

    July 20, 2026

    Essential Slurm Administration Commands Every HPC Administrator Should Know

    July 15, 2026

    How to Install, Configure, and Use tmux on Linux

    July 14, 2026
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Sunday, August 2
    DPC Virtual Tips
    • Home
    • Operating Systems
    • CLI
    • PowerFlex
    • HPC
    • Certificates
    • Virtualization
    • About Us
    • Contact
    DPC Virtual Tips
    Home » Working with Python Virtual Environments on Windows
    Operating Systems

    Working with Python Virtual Environments on Windows

    DaniloBy DaniloJanuary 12, 2026Updated:August 2, 2026No Comments3 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Python virtual environment on Windows
    Share
    Facebook Twitter LinkedIn Pinterest Email

    A Python virtual environment on Windows allows developers to create isolated environments for different projects, keeping Python packages and dependencies separated. In this guide, I will show how to create, activate, use, and manage a virtual environment using the built-in Python venv module.

    When working with Python projects, managing different library versions can become a challenge. A virtual environment provides a clean and organized way to install project-specific packages without affecting the global Python installation on Windows.

    I created this practical guide to demonstrate how Python virtual environments work in a Windows environment, including common tasks such as installing modules, running scripts, deactivating the environment, and creating a requirements.txt file.

    First and foremost, if you are new to Python like me and would like to install Python on Windows, we’ve written a short article to show how to do it. Click here to access this article.

    What is Python Virtual Environment?

    A Python virtual environment (often called venv) is a way to create an isolated “mini-Python installation” for each project.

    We can think of it like this:

    • Your Windows system has:
      • One global Python installation.
      • Many projects, each one needing different modules/libraries versions.

    Without Python virtual environments:

    • Installing a package (a module, for example) for one project affects all projects.
    • Version conflicts happen (Project A needs the requests 2.28, Project B needs the same requests module, but in the 2.31 version).

    With Python virtual environments:

    • Each project gets its own:
      • Python interpreter.
      • pip.
      • Installed modules and libraries.
    • No conflicts, clean and safe.

    Why You Should Use It?

    Using a Python virtual environment will:

    • Keep your operating system clean.
    • Allow you work on many Python projects at the same time.
    • Let you test versions safely.
    • Make your projects portable.

    How does it work on Windows?

    Let’s get started and explain it in a practical way:

    1. To create a Python virtual environment (venv), open the command-line (cmd) and create the virtual environment (of course, Python must be installed). In this case, for instance, the Python venv name is “my_first_venv”:

    python -m venv my_first_venv

    2. Look at a new directory that was created with the same venv name:

    Inside it, we have the necessary structure to support our virtual environment:

    3. After creating the venv, we need to activate it to use it effectively:

    my_first_venv\Scripts\activate

    After activating the venv, the prompt command was changed and added the venv name at the initial – it indicates that the venv was enabled successfully:

    4. Now, let’s install the paramiko module:

    pip install paramiko

    It installs only inside that project 😉

    Inside the “Lib\site-packages” on the venv directory, we can see the paramiko packages:

    5. Executing a Python script inside the venv:

    Note: This is a very simple Python script, just to show the functionality:

    6. To deactivate the virtual environment:

    deactivate

    Note: Look at the command prompt – the Python venv name is removed from it after deactivating!

    7. If you need to go back and work with the venv again, just activate it again. Look, you can specify the absolute path to activate it:

    C:\python\my_first_venv\Scripts\activate

    8. To make your project portable, you can create a “requirements.txt” file inside your venv and put in it all the necessary modules to work with your project. For example:

    As we can see, our requirements file lists the modules paramiko, pyvmomi, and requests, along with their versions. To install these packages into the venv:

    pip install -r requirements.txt

    In short: A Python virtual environment is a safe, isolated, project-specific Python world!

    That’s it for now 🙂

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleInstalling Python on Windows
    Next Article Creating a Simple Python Project Using a Virtual Environment
    Danilo

    Infrastructure Engineer with experience in Virtualization, Linux, Windows Server and learning automation using Python. DPC Virtual Tips was created to share practical tutorials, lab experiences and troubleshooting guides focused on enterprise infrastructure technologies.

    Related Posts

    Linux Commands to Investigate High Disk Partition Usage

    July 20, 2026

    How to Install, Configure, and Use tmux on Linux

    July 14, 2026

    Installing Rocky Linux

    April 27, 2026

    Comments are closed.

    Search
    Categories
    • Certificates (5)
    • CLI (7)
    • HPC (7)
    • Operating Systems (75)
    • PowerFlex (22)
    • Virtualization (122)
    Read More
    Operating Systems

    Linux Commands to Investigate High Disk Partition Usage

    By DaniloJuly 20, 20260
    HPC

    Essential Slurm Administration Commands Every HPC Administrator Should Know

    By DaniloJuly 15, 20260
    Operating Systems

    How to Install, Configure, and Use tmux on Linux

    By DaniloJuly 14, 20260
    HPC

    Getting Started with Lustre File System

    By DaniloJuly 13, 20260
    Operating Systems

    Installing Rocky Linux

    By DaniloApril 27, 20260
    Latest Posts

    Linux Commands to Investigate High Disk Partition Usage

    July 20, 2026

    Essential Slurm Administration Commands Every HPC Administrator Should Know

    July 15, 2026

    How to Install, Configure, and Use tmux on Linux

    July 14, 2026
    Images from Gallery
    linux tux
    hpc main commands
    linux commands
    install rock linux
    lustre fs
    Categories
    • Certificates
    • CLI
    • HPC
    • Operating Systems
    • PowerFlex
    • Virtualization
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Copyright © 2026, DPC Virtual Tips. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.

    We use cookies to ensure your best experience on our website. If you continue using our website, we'll assume you agree to our cookie policy