诗歌 - 找出与其他依赖项兼容的最新版本
Poetry - Figure out the latest version which is compatible with other dependencies
使用poetry,有时在检查依赖项时,Poetry 会提示由于兼容性问题无法安装某些东西。
比如我的项目numpy==1.19.2
。现在,当我尝试安装 pandas
时,我得到以下内容
$: poetry add pandas
The currently activated Python version 3.6.9 is not supported by the project (>=3.8,<3.11).
Trying to find and use a compatible version.
Using python3.9 (3.9.7)
Using version ^1.3.4 for pandas
Updating dependencies
Resolving dependencies... (0.6s)
SolverProblemError
Because no versions of pandas match >1.3.4,<2.0.0
and pandas (1.3.4) depends on numpy (>=1.20.0), pandas (>=1.3.4,<2.0.0) requires numpy (>=1.20.0).
So, because my_project depends on both numpy (1.19.2) and pandas (^1.3.4), version solving failed.
如何确定我应该安装哪个 pandas
版本以与我的 numpy
版本兼容?
如果您使用 *
版本限定符执行 pandas 包添加的干 运行 它应该解析为与您的其他依赖项兼容的最新版本:
poetry add pandas@* --dry-run
您将在命令输出中看到要安装的 pandas 的确切版本。然后,您可以使用该版本更新 pyproject.toml
文件中的版本限定符。
或者,直接在 pyproject.toml
文件中使用 *
限定符,如下所示:
[tool.poetry.dependencies]
...
pandas = "*"
...
使用poetry,有时在检查依赖项时,Poetry 会提示由于兼容性问题无法安装某些东西。
比如我的项目numpy==1.19.2
。现在,当我尝试安装 pandas
时,我得到以下内容
$: poetry add pandas
The currently activated Python version 3.6.9 is not supported by the project (>=3.8,<3.11).
Trying to find and use a compatible version.
Using python3.9 (3.9.7)
Using version ^1.3.4 for pandas
Updating dependencies
Resolving dependencies... (0.6s)
SolverProblemError
Because no versions of pandas match >1.3.4,<2.0.0
and pandas (1.3.4) depends on numpy (>=1.20.0), pandas (>=1.3.4,<2.0.0) requires numpy (>=1.20.0).
So, because my_project depends on both numpy (1.19.2) and pandas (^1.3.4), version solving failed.
如何确定我应该安装哪个 pandas
版本以与我的 numpy
版本兼容?
如果您使用 *
版本限定符执行 pandas 包添加的干 运行 它应该解析为与您的其他依赖项兼容的最新版本:
poetry add pandas@* --dry-run
您将在命令输出中看到要安装的 pandas 的确切版本。然后,您可以使用该版本更新 pyproject.toml
文件中的版本限定符。
或者,直接在 pyproject.toml
文件中使用 *
限定符,如下所示:
[tool.poetry.dependencies]
...
pandas = "*"
...