• 官方文档:https://python-poetry.org/docs/
  • poetry 查看配置项

    poetry config --list
  • 修改缓存目录

    poetry config cache-dir D:\pypoetry
  • 将虚拟目录放在项目内

    poetry config virtualenvs.in-project true
  • 发现 pyenv 等虚拟环境的 python 解释器

    poetry config virtualenvs.prefer-active-python true
  • 软件包国内镜像(pyproject.toml)

    [[tool.poetry.source]]
    name = "aliyun"
    url = "https://mirrors.aliyun.com/pypi/simple/"
    default = true
    [[tool.poetry.source]]
    name = "douban"
    url = "https://pypi.doubanio.com/simple/"
    default = true
  • 指定特定平台(linux)的第三方包

    [tool.poetry.dependencies]
    python = "~3.8.8"
    fastapi = { version = "~0.65.3", extras = ["all"] }
    gunicorn = { version = "~20.1.0", platform = "linux"}
  • poetry 导出 requirements.txt

    poetry export -f requirements.txt --output requirements.txt
    poetry export --without-hashes -f requirements.txt --output requirements.txt
本文出自 qbit snap

qbit
268 声望279 粉丝

引用和评论

0 条评论