Python 依赖管理和打包工具 Poetry 安装和测试

本文详细介绍了Python的依赖管理工具Poetry的安装、卸载、测试及虚拟环境的使用,包括不同操作系统的安装方法,如何创建项目、查看和更新依赖,以及自定义镜像源设置。此外,还提到了Poetry的离线安装方法。
摘要由CSDN通过智能技术生成

Poetry 是 一个 Python 依赖管理和打包工具。 它允许您声明项目所依赖的库,并将为您管理(安装/更新)它们。

官网:
https://python-poetry.org/

Poetry 安装方法有三种:

  • With the official installer
  • With pipx
  • With pip

官方推荐使用官方安装脚本,位于:
https://python-poetry.org/docs/。

注意: get-poetry.py 脚本将在 Poetry 1.2 中被 install-poetry.py 替代,建议直接使用最新版本的安装脚本。方法是在顶部的版本选择下拉框中选择 master。

官网默认的安装脚本仍然是get-poetry.py,在安装时过程中我注意到提示信息中含有如下提示:This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.

这才注意到选择install-poetry.py更好。

安装

对于Windows操作系统,需要在PowerShell下输入

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -

安装过程如下:

注意:由于服务器位于国外,安装过程很慢,建议科学上网。

This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located 
  • 6
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值