Poetry安装Scipy失败(Manjaro Linux,Python 3.10.5)

Aa *_* Ww 2 python pip scipy

我尝试使用 Poetry 安装 Scipy,但收到以下错误消息:

\n
Using version ^1.9.0 for scipy\n\n  The current project's Python requirement (>=3.10,<4.0) is not compatible with some of the required packages Python requirement:\n    - scipy requires Python >=3.8,<3.12, so it will not be satisfied for Python >=3.12,<4.0\n  \n  Because scipy (1.9.0) requires Python >=3.8,<3.12\n   and no versions of scipy match >1.9.0,<2.0.0, scipy is forbidden.\n  So, because assistant depends on scipy (^1.9.0), version solving failed.\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/puzzle/solver.py:241 in _solve\n      237\xe2\x94\x82             packages = result.packages\n      238\xe2\x94\x82         except OverrideNeeded as e:\n      239\xe2\x94\x82             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)\n      240\xe2\x94\x82         except SolveFailure as e:\n    \xe2\x86\x92 241\xe2\x94\x82             raise SolverProblemError(e)\n
Run Code Online (Sandbox Code Playgroud)\n

小智 8

我有一个类似的依赖错误,诗歌无法安装 scipy。对我来说,解决方法是将文件中的 Python 行更改为pyproject.toml

python = "^3.10"
Run Code Online (Sandbox Code Playgroud)

python = ">=3.10,<3.12"
Run Code Online (Sandbox Code Playgroud)

我不完全确定为什么会修复它,因为它实际上并没有改变它安装的 python 版本,只是它如何看待约束。

编辑 16/05/2023
这是因为^3.10隐含版本>=3.10,<4.0,同时scipy明确支持 python 最高版本3.12