pyenv - manage python versions

Stefan Alfbo - Jul 8 '23 - - Dev Community

I wish that I new about pyenv when I started to programming in Python.

This tool makes it easy to manage and switch between different Python versions and environments.

To install it make sure that all prerequisites are met. Then use the pyenv-installer project like this to get the tool installed:

curl https://pyenv.run | bash
Enter fullscreen mode Exit fullscreen mode

When pyenv is available on your machine you can easily create a new virtual Python environment for your next project:

pyenv virtualenv 3.10.0 my_new_project
Enter fullscreen mode Exit fullscreen mode

This will create a new environment named, my_new_project, that is using the version 3.10.0 of Python.

And to activate the environment:

pyenv activate my_new_project
Enter fullscreen mode Exit fullscreen mode

There are many more features provided by the pyenv-tool that can be explored, read more at GitHub.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .