# Python Virtual Environment

<br>

### Purpose of Python virtual environment

* To create an isolated environment for different Python projects
  * You can install a specific version of module on each project without worrying that it will affect your other Python projects.

\ <br>

## Create Virtual Environment for Python 3

<br>

> Check your python version

```bash
$ python --version
Python 3.6.9
```

<br>

> Install `virtualenv`

```bash
pip install virtualenv
```

<br>

> Create a virtual environment

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

<br>

> activate your virtual environment

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

<br>

> set up command alias in .`bashrc`

```bash
alias va="source venv/bin/activate"
```

<br>


---

# 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://chloe-codes1.gitbook.io/til/python/python-101/python_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.
