> For the complete documentation index, see [llms.txt](https://chloe-codes1.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chloe-codes1.gitbook.io/til/python/python-101/python_virtual_environment.md).

# 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>
