Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtual Environment for FastAPI

A quick question, do we need to create virtual environment for installing and using FastAPI. We use venv for Django right? So why not in FastAPI?

like image 287
Adnan K Avatar asked Aug 25 '26 17:08

Adnan K


2 Answers

You can and you should use virtual environments. Usually each project has its own environment.

Some IDEs have automated the process and made it trivial. For example PyCharm asks you during the creation of the project, but you can also do so afterwards.

like image 197
PythonForEver Avatar answered Aug 28 '26 08:08

PythonForEver


You also can use virtual environment for fastapi projects. This is described in the documentation https://fastapi.tiangolo.com/contributing/#virtual-environment-with-venv.

Creating a virtual environment is necessary to separate your Python packages and is independent of your project.

like image 37
Anton Semenov Avatar answered Aug 28 '26 07:08

Anton Semenov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!