The Python Oracle

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

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: Future Grid Looping

--

Chapters
00:00 How Can I Specify Which Python Version Poetry Should Create Venv?
01:18 Accepted Answer Score 43
01:53 Thank you

--

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

--

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.