我可以仅使用诗歌安装新版本的Python吗?

发布于 2025-01-19 18:24:21 字数 1214 浏览 1 评论 0原文

免责声明

我是诗歌

新手

  1. 的 不在乎我如何指定它,但大概是在pyproject.toml中)
  2. 运行命令(大概是poetry shell诗歌>诗歌安装,也许在与诗歌env使用)的结合,使我进入了我已经指定的python版本的环境(我不介意它是几个命令,而不是仅一个命令)

  • <代码>诗歌env使用3.10 (当我还没有安装python 3.10时)
    • 这给了我一个错误:/bin/sh:python3.10:找不到命令
    • 值得注意的是,我明白了为什么出现此错误,我只是想拥有Poetry在这种情况下安装Python 3.10
  • 诗歌env使用3.10(当我在conda Env中,已安装了Python 3.10)
    • 这有效!但是... python可执行与conda env
    • 中的一个相称
    • 也许这很好,但是我的目标是使用诗歌而不是conda,所以我想避免依靠conda安装Python版本

我看到的人所做的是:

使用诗歌pyenv (其中pyenv用于安装Python版本)。

因此,我的问题是:

是否使用pyenv来安装必要的python版本?是否没有办法告诉诗歌我想要 it 安装给定的Python版本?

我已经浏览了诗歌文档,他们的GH问题以及一些帖子,但是(如果我缺少某些内容,请再次表示歉意。

附加信息

  • 诗歌版本:1.1.13
  • OS:MacOS(Catalina)
  • Python版本用于安装Poetry(因此,它似乎默认为):3.7.6
  • Happy添加其他相关内容:)

Disclaimer

I'm new to poetry and I've searched around, but apologies if I've missed something obvious..

What I want to do is:

  1. specify an arbitrary python version in a poetry project (I don't care how I specify it, but presumably in pyproject.toml)
  2. run a command (presumably poetry shell or poetry install, maybe in conjunction with poetry env use) that puts me into an environment that uses the python version I specified above (I don't mind if it's a few commands instead of just one)

I've already tried:

  • poetry env use 3.10 (when I don't have python 3.10 installed already)
    • This gives me an error: /bin/sh: python3.10: command not found
    • Notably, I get why this error is showing up, I'd just like to have poetry install python 3.10 in this case
  • poetry env use 3.10 (when I'm in a conda env that has python 3.10 installed)
    • This works! But... the python executeable is symlinked to the one in the conda env
    • Maybe this is fine, but my goal is to use poetry instead of conda so I'd like to avoid relying on conda to install python versions

What I've seen people do is:

Use poetry in conjunction with pyenv (where pyenv is used to install the python version).

So, my question is:

Is using something like pyenv to install python versions necessary? Is there no way to tell poetry that I want it to install a given python version?

I've looked through the poetry docs, their GH issues, and some SO posts, but (again) apologies if I'm missing something.

Additional Info

  • poetry version: 1.1.13
  • OS: MacOS (Catalina)
  • python version used to install poetry (and therefore the one it seems to default to): 3.7.6
  • happy to add anything else relevant :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枯寂 2025-01-26 18:24:21

Poetry不能也不会为你安装任何python解释器。这超出了范围。用户有责任提供一份。

pyenv 是一种方法。

Poetry cannot and will not install any python interpreter for you. This is out of scope. It's the responsibility of the user to provide one.

pyenv is one way of doing it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文