# Python Virtual Environments

#### Steps to Create and Use a Virtual Environment:

1. **Open a Terminal or Command Prompt**
2. **Navigate to Your Project Directory** (Optional): If you are working on a specific project, navigate to the project folder where you want to create the virtual environment

```bash
$ cd path/to/your/project
```

3. **Create the Virtual Environment**: Run the following command to create a virtual environment. The recommended method is to use `python -m venv` followed by the name you want to give to your virtual environment (usually `venv` or `env`):

```bash
$ python -m venv venv
```

This will create a `venv` directory containing the virtual environment files in your current folder.

4. **Activate the Virtual Environment**: After creating the virtual environment, you need to activate it.

* **On Windows**:

```bash
$ venv\Scripts\activate
```

* **On macOS and Linux**:

```bash
$ source venv/bin/activate
```

5. **Install Packages**: Once the virtual environment is activated, you can install packages using `pip`. For example:

```bash
$ pip install package_name
```

6. **Deactivate the Virtual Environment**: When you're done working in your virtual environment, you can deactivate it by running:

```bash
$ deactivate
```

7. **Using the Virtual Environment**: Each time you want to work on your project, you'll need to reactivate the virtual environment by running the activation command again.


---

# 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://wiki.smhuda.com/pentesting/tool-usage/python-virtual-environments.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.
