Poetry
用起来非常像前端的 NPM
Quick Start
poetry new my_project
poetry init
代理
poetry 通过 PyPI 软件仓库来下载依赖。如果在国内访问默认的镜像速度很慢,可以通过在 pyproject.toml 末尾添加下面的内容来设置自定义镜像源:
[[tool.poetry.source]]
name = "aliyun"
url = "https://mirrors.aliyun.com/pypi/simple/"
priority = "primary"
[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
附常用的国内 PyPI 镜像列表:
- 阿里云 https://mirrors.aliyun.com/pypi/simple/
- 豆瓣 https://pypi.doubanio.com/simple/
- 网易 https://mirrors.163.com/pypi/simple/
- 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
via: https://yanxi123.com/post/2023/12/python-poetry/
Install locally
Before install, you should build it:
poetry build
In venv environment, you could run command directly:
poetry install .
But If you want install globally and test, recommend you using pipx
deactivate
pipx install .