python依赖管理工具poetry

作者:matrix 被围观: 1,948 次 发布时间:2021-11-30 分类:Python | 2 条评论 »

这是一个创建于 839 天前的主题,其中的信息可能已经有所发展或是发生改变。

用的pipenv但是lock时间有点太长了,所以到poetry试试水...

poetry安装

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

项目设置poetry虚拟环境

poetry init

按照选项默认就好

给虚拟环境安装依赖

poetry add requests=3.6
poetry add requests@last

安装之后系统会自动生成pyproject.toml,poetry.lock文件

删除依赖

poetry remove requests

显示依赖信息

poetry show

poetry show --tree 

使用三方源

pyproject.toml 末尾:

[[tool.poetry.source]]
name = "tsinghua"
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"

用熟悉了基本命令也就清楚,不用翻文档。但是vscode上兼容性不好,还要自己配置解析器😭

参考:

https://Python-poetry.org/docs/basic-usage/

https://greyli.com/poetry-a-better-choice-than-pipenv/

其他文章:
本文固定链接:https://www.hhtjim.com/python-poetry-dependency-management-tool.html
matrix
本文章由 matrix 于2021年11月30日发布在Python分类下,目前没有通告,你可以至底部留下评论。
转载请注明:python依赖管理工具poetry-HHTjim'S 部落格
关键字:,

有2 条评论 »

  1. 谷歌优化 谷歌优化 2022-10-10 10:12:48 +0800#2

    文章很好,请继续保持更新啊

  2. 自媒体运营 自媒体运营 2021-12-7 12:01:42 +0800#1

    又是一个值得我学习的博客,感谢博主的无私分享,希望自己也可以通过努力做成这样,也希望站长大大是否可以花一点时间访问一下我的小河自媒体博客,看看还有哪里是欠缺的!

添加新评论 »

 🙈 😱 😂 😛 😭 😳 😀 😆 👿 😉 😯 😮 😕 😎 😐 😥 😡 😈 💡

插入图片

NOTICE: You should type some Chinese word (like “你好”) in your comment to pass the spam-check, thanks for your patience!