110 字
1 分钟
Poetry
2024-12-04

Reference#

Install#

curl -sSL https://install.python-poetry.org | python3 -

Config#

Config file location#

  • macOS: ~/Library/Application Support/pypoetry
  • Windows: %APPDATA%\pypoetry
  • Unix: ~/.config/pypoetry

project env#

poetry config virtualenvs.in-project true

这样poetry就会在项目目录下建立虚拟环境文件夹.venv

Common commands#

poetry init  # 初始化
poetry env use python3.11  # 指定虚拟环境python版本
poetry source add --priority=primary mirrors https://pypi.tuna.tsinghua.edu.cn/simple/  # 配置镜像源
poetry install --no-root  # 安装所有依赖,--no-root不会安装项目本身
poetry add xxxx   # 添加python包
poetry add xxxx -G dev  # 添加开发环境的python包
Poetry
https://lordhamster.com/posts/poetry/
作者
LordHamster
发布于
2024-12-04
许可协议
CC BY-NC-SA 4.0