Home > Back-end >  Virtual Environment for FastAPI
Virtual Environment for FastAPI

Time:08-25

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?

CodePudding user response:

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.

CodePudding user response:

Yes, you can create a Virtual Environment in FastAPI and maintain your dependencies. Virtual Environments is not Framework dependent. You can use it with any framework.

CodePudding user response:

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.

CodePudding user response:

You should create a virtual environment for each project. You can easily maintain and keep track of your dependencies.

I highly recommend you to use the Anaconda to create and manage the virtual environments

  • Related