[Python] Problem starting my virtual environment with python + FastAPI + Uvicorn

Discussão em 'Python' iniciado por Stack, Abril 16, 2025.

  1. Stack

    Stack Membro Participativo

    I have a problem starting my first virtual environment in Python using FastAPI with Uvicorn.

    Following the guide of FastAPI and having installed the full pack of FastAPI.

    I get this error after introducing:

    uvicorn main:app --reload I've the next message: 'uvicorn: The term 'uvicorn' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.'

    I've read comments in this equipe of work and I tried with another way introducing in terminal :

    python -m uvicorn main:app --reload


    In that case the error was different:

    INFO: Will watch for changes in these directories: ['C:\Users\Ivan\OneDrive\Escritorio\Univcorn'] INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started reloader process [14496] using WatchFiles ERROR: Error loading ASGI app. Could not import module "main".

    The name of the file is 'main.py' an the object that I calling is 'app.

    Has someone here had the same problem, or can help me to resolve?

    Continue reading...

Compartilhe esta Página