The Python Oracle

How can I specify which Python version poetry should create venv?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Luau

--

Chapters
00:00 Question
01:34 Accepted answer (Score 26)
02:16 Thank you

--

Full question
https://stackoverflow.com/questions/6655...

Question links:
[Poetry]: https://python-poetry.org/
[Pandas]: https://en.wikipedia.org/wiki/Pandas_%28...

Accepted answer links:
[pyenv]: https://github.com/pyenv/pyenv
[pyenv-win]: https://github.com/pyenv-win/pyenv-win
[here]: https://python-poetry.org/docs/managing-...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #package #version #packagemanagers #pythonpoetry

#avk47



ACCEPTED ANSWER

Score 43


Poetry can't fully manage Python versions on its own using the version specified in the pyproject.toml. You can either use a tool like pyenv (or pyenv-win if you're using Windows) for managing multiple versions, or you can use poetry env use path/to/python. If Python 3.9 is in your path or available on your system via pyenv or some similar version management tool, you can use poetry env use python3.9 or poetry env use 3.9. You can read more about poetry env use here.