# Virtual Environment

**A virtual environment in Python is a self-contained directory that encapsulates a specific Python interpreter along with its dependencies. It allows you to create an isolated environment for your Python projects, ensuring that each project can have its dependencies without interfering with the global Python installation.**

**Benefits of Virtual Environments:**

* **Isolation:** Each project can have its own set of dependencies, avoiding conflicts between different projects.
* **Version:** You can easily switch between Python versions for different projects.
* **Dependency:** It helps in managing and isolating project-specific libraries and packages.
* **Clean Environment:** Virtual environments keep your system's global Python environment clean.

**Starting a Project with a Virtual Environment:**

The first step when starting a Python project is to create a virtual environment.

**For Windows Users:**

Follow the step-by-step guide to set up and activate a virtual environment

{% file src="/files/Kz4DYsAsdfFf5gRnw49q" %}

**For Mac Users:**

Follow the provided steps to install and activate a virtual environment.

{% file src="/files/pKgHdbYDSvpuMKFavi1s" %}

{% embed url="<https://www.youtube.com/watch?v=G2xZ-yAAmDI>" %}
Installing Python on Windows and Mac, and Creating a Virtual Environment
{% endembed %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-javaher.gitbook.io/pythonclass/python-workshops/virtual-environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
