使用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
版本兼容
发布于 2021-11-02 08:30:06
如果您使用*
版本限定符执行pandas包添加的演练,它应该解析为与您的其他依赖项兼容的最新版本:
poetry add pandas@* --dry-run
您将在命令输出中看到要安装的pandas的确切版本。然后,您可以使用该版本更新pyproject.toml
文件中的版本限定符。
或者,直接在pyproject.toml
文件中使用*
限定符,如下所示:
[tool.poetry.dependencies]
...
pandas = "*"
...
https://stackoverflow.com/questions/69810753
复制