> For the complete documentation index, see [llms.txt](https://fastapi-docs.duonghuuphuc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fastapi-docs.duonghuuphuc.com/unit-4-install-fastapi.md).

# Unit 4: Install FastAPI

## Creation of virtual environments

A *virtual environment* is created on top of an existing Python installation, known as the virtual environment’s "base” Python, and may optionally be isolated from the packages in the base environment, so only those explicitly installed in the virtual environment are available.

There is a wide range of  virtual environment modules in Python:

* [venv](https://docs.python.org/3/library/venv.html)
* [virtualenv](https://pypi.org/project/virtualenv/)
* [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/)
* [Anaconda](https://www.anaconda.com/download/success) *(Recommended for beginners)*

[Python](https://www.python.org/downloads/) must be installed on your computer before installing virtual environment modules. For macOS, you can take advantage of [Homebrew](https://brew.sh/) to install virtual environment modules.

Taking [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) as an example:

* To install, execute this command in CMD/Terminal: `pip install virtualenvwrapper`
* To create a new virtual environment: `mkvirtualenv env1`
* To deactivate a virtual environment: `deactivate`
* You can refer to [this document](https://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html) to discover more useful commands in virtualenvwrapper.

***

## Install FastAPI

For the tutorial, you might want to install FastAPI with all the optional dependencies and features, by executing the below command in a virtual environment:

```
pip install "fastapi[all]"
```
