Current Python version (3.9.7) is not allowed by the project (^3.11)

huangapple go评论58阅读模式
英文:

Current Python version (3.9.7) is not allowed by the project (^3.11)

问题

我们有一个使用pyproject.toml文件的诗歌项目,内容如下:

[tool.poetry]
name = "daisy"
version = "0.0.2"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.9"
pandas = "^1.5.2"
DateTime = "^4.9"
names = "^0.3.0"
uuid = "^1.30"
pyyaml = "^6.0"
psycopg2-binary = "^2.9.5"
sqlalchemy = "^2.0.1"
pytest = "^7.2.0"

[tool.poetry.dev-dependencies]
jupyterlab = "^3.5.2"
line_profiler = "^4.0.2"
matplotlib = "^3.6.2"
seaborn = "^0.12.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

当我将文件更改为使用Python 3.11并运行poetry update时,我们会收到以下错误:

当前Python版本(3.9.7)不符合项目的要求(^3.11)。
请通过“env use”命令更改Python可执行文件。

我只有一个环境:

> poetry env list
daisy-Z0c0FuMJ-py3.9(已激活)

奇怪的是,这个问题在我的Macbook上没有出现,只在我们的Linux机器上出现。

英文:

We have a poetry project with a pyproject.toml file like this:

[tool.poetry]
name = "daisy"
version = "0.0.2"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.9"
pandas = "^1.5.2"
DateTime = "^4.9"
names = "^0.3.0"
uuid = "^1.30"
pyyaml = "^6.0"
psycopg2-binary = "^2.9.5"
sqlalchemy = "^2.0.1"
pytest = "^7.2.0"

[tool.poetry.dev-dependencies]
jupyterlab = "^3.5.2"
line_profiler = "^4.0.2"
matplotlib = "^3.6.2"
seaborn = "^0.12.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

When I change the file to use Python 3.11 and run poetry update we get the following error:

Current Python version (3.9.7) is not allowed by the project (^3.11).
Please change python executable via the "env use" command.

I only have one env:

> poetry env list
daisy-Z0c0FuMJ-py3.9 (Activated)

Strangely this issue does not occur on my Macbook, only on our Linux machine.

答案1

得分: 2

无法更新现有虚拟环境的 Python 版本。请删除现有的虚拟环境,然后再次运行 poetry install

英文:

Poetry cannot update the Python version of an existing venv. Remove the existing one and run poetry install again.

huangapple
  • 本文由 发表于 2023年2月8日 19:13:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75384957.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定