'Can I install a new version of python using only poetry?
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:
- specify an arbitrary python version in a poetry project (I don't care how I specify it, but presumably in
pyproject.toml) - run a command (presumably
poetry shellorpoetry install, maybe in conjunction withpoetry 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
poetryinstall python 3.10 in this case
- This gives me an error:
poetry env use 3.10(when I'm in acondaenv that has python 3.10 installed)- This works! But... the
pythonexecuteable is symlinked to the one in the conda env - Maybe this is fine, but my goal is to use
poetryinstead ofcondaso I'd like to avoid relying oncondato install python versions
- This works! But... the
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
poetryversion: 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 :)
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | finswimmer |
