我用 Poetry 创建了一个 python 项目“foo”。这是的内容pyproject.toml
:
[tool.poetry]
name = "bar"
version = "0.1.0"
description = ""
[tool.poetry.dependencies]
python = ">=3.5"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
该包兼容 Python3.5。我想要黑色格式化程序,它与 Python3.5 不兼容。我认为如果我使用 Python>=3.6 进行开发是没有问题的,但是我无法安装黑色格式化程序:
$ poetry add black --dev
[SolverProblemError]
The current project's Python requirement (>=3.5) is not compatible with some of the required packages Python requirement:
- black requires Python >=3.6
Because no versions of black match >19.10b0,<20.0
and black (19.10b0) requires Python >=3.6, black is forbidden.
So, because bar depends on black (^19.10b0), version solving failed.
所以我直接安装了黑色pip
:
$ poetry run pip install black
这种方式不适合我。我想black
通过诗歌安装。
我应该怎么做?(我不想将依赖项修改为python>=3.6
)