首页 > 解决方案 > 从终端调用时,uvicorn 不工作

问题描述

我尝试通过 pip3 在系统上安装 uvicorn,但我无法从命令行运行它。有关如何解决此问题的任何指示?

Requirement already satisfied: uvicorn in /home/vhawk19/.local/lib/python3.7/site-packages (0.10.8)
Requirement already satisfied: uvloop>=0.14.0; sys_platform != "win32" and sys_platform != "cygwin" and platform_py
thon_implementation != "pypy" in /home/vhawk19/.local/lib/python3.7/site-packages (from uvicorn) (0.14.0)
Requirement already satisfied: websockets==8.* in /home/vhawk19/.local/lib/python3.7/site-packages (from uvicorn)
(8.1)
Requirement already satisfied: click==7.* in /home/vhawk19/.local/lib/python3.7/site-packages (from uvicorn) (7.0
)
Requirement already satisfied: h11==0.8.* in /home/vhawk19/.local/lib/python3.7/site-packages (from uvicorn) (0.8
.1)
Requirement already satisfied: httptools==0.0.13; sys_platform != "win32" and sys_platform != "cygwin" and platform
_python_implementation != "pypy" in /home/vhawk19/.local/lib/python3.7/site-packages (from uvicorn) (0.0.13)
vhawk19@api-server:~/api-server$ uvicorn
-bash: uvicorn: command not found```

标签: pythonpython-3.xasgiuvicorn

解决方案


您可以直接从 cmd 使用以下命令。该路径适合我的情况,但使用 uvicorn 命令仍然出现错误。

python -m uvicorn 

推荐阅读