# Python Virtual Environments and `pip`

## Virtual Environments

A virtual environment is a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages.

### Creating a Virtual Environment

You can create a virtual environment using the `venv` module.

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

### Activating a Virtual Environment

On Windows, you can activate a virtual environment using the following command:

```bash
myenv\Scripts\activate.bat
```

On macOS and Linux, you can activate a virtual environment using the following command:

```bash
source myenv/bin/activate
```

## `pip`

`pip` is the package installer for Python. You can use `pip` to install packages from the Python Package Index (PyPI).

### Installing a Package

```bash
pip install requests
```

### Uninstalling a Package

```bash
pip uninstall requests
```

### Listing Installed Packages

```bash
pip list
```

[[programming/python/python]]