How to create and use a Virtual Environment in Python

August 13, 2025 / Web Design & Development Web Hosting

This article will teach you how to use Python to create and manage a virtual environment.

A virtual setup is an isolated workstation that allows you to manage Python packages independently for each project, eliminating conflicts.

Let us follow the steps:

  1. Make sure Python is installed by opening your terminal and checking the version with:
    python --version

    or

    python3 --version
  2. Run the following to create a virtual environment in your project folder:
    python -m venv env

    This creates an isolated environment named env.

  3. Activate the virtual environment:
    1. On Windows, run:
      .\env\Scripts\activate
    2. On macOS/Linux, run:
      source env/bin/activate

      Your terminal prompt will change to show it’s active.

  4. Install packages inside the activated setting using ‘pip’, for instance:
    pip install requests
  5. When finished, deactivate the virtual environment by running:
    deactivate

In such a manner, you can create and use a virtual environment in Python. If you require further assistance, please don’t hesitate to contact our support staff.

Want to explore alternative installation methods? Learn How to Install Python libraries without using the pip command

Spread the love