简体   繁体   English

诗歌使用错误Python版本

[英]Poetry using wrong Python version

Trying to install packages using poetry And getting:尝试使用诗歌安装软件包并获得:

Current Python version (3.10.4) is not allowed by the project (>=3.8,<3.10).

Then I'm trying to do:然后我想做的是:

poetry env use python3.8

Or或者

poetry env use 3.8

And the same error popping.同样的错误弹出。 Any reason this could happen?这可能发生的任何原因?

Make sure that when you are switching python version you are using a full path, so poetry has no problem with resolving the version:确保在切换 python 版本时使用的是完整路径,这样 poetry 解析版本就没有问题了:

poetry env use /usr/bin/python3.8

If that didn't help, check your pyproject.toml and make sure that the version of python is compatible, something like:如果这没有帮助,请检查您的pyproject.toml并确保 python 的版本兼容,例如:

python = "^3.8"

If that's not the case try setting up global version:如果不是这种情况,请尝试设置全局版本:

pyenv global 3.8.15

Also, make sure that all the utility tools are compatible with expected python version:此外,确保所有实用工具都与预期的 python 版本兼容:

sudo apt-get install python3.8-distutils
apt install build-essential libssl-dev libffi-dev python3-dev -y

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM