因为 poetry 会构建一个 virtual environment, 因此需要用 poetry run 来运行虚拟环境中的命令:
1
poetry run python main.py
又如:
1
poetry run uvicorn main:app --port 8088 --reload
查看虚拟环境中的包信息
1
poetry show
输出如:
1 2 3 4 5 6 7 8 9
annotated-types 0.7.0 Reusable constraint types to use with typing.Annotated anyio4.4.0 High level compatibility layer for multiple asynchronous event loop implement... fastapi0.112.2 FastAPI framework, high performance, easy to learn, fast to code, ready for p... idna3.8 Internationalized Domain Names in Applications (IDNA) pydantic2.8.2 Data validation using Python type hints pydantic-core 2.20.1 Core functionality for Pydantic validation and serialization sniffio1.3.1 Sniff out which async library your code is running under starlette0.38.4 The little ASGI library that shines. typing-extensions 4.12.2 Backported and Experimental Type Hints for Python 3.8+