使用诗歌,有时在检查依赖关系时诗歌会指示由于兼容性问题而无法安装某些东西。
例如,我的项目中有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.
Run Code Online (Sandbox Code Playgroud)
如何确定pandas应该安装哪个版本才能与我的版本兼容numpy?
elu*_*kem 12
如果您使用版本限定符执行 pandas 包添加的试运行,*它应该解析为与其他依赖项兼容的最新版本:
poetry add pandas@* --dry-run
Run Code Online (Sandbox Code Playgroud)
您将在命令输出中看到将安装的 pandas 的确切版本。然后,您可以使用该版本来更新文件中的版本限定符pyproject.toml。
或者,*直接在pyproject.toml文件中使用限定符,如下所示:
[tool.poetry.dependencies]
...
pandas = "*"
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4497 次 |
| 最近记录: |