Willy's blog



pyenv is a shell script to manage python versions. Works in the user space, avoiding the system's python, therefore is less error prone. You can also control a per directory version (this creates a .python-version). Doesn't require python.


Use pyenv-installer

curl https://pyenv.run | bash
exec $SHELL  # Restart shell or open new terminal


Install different python versions

pyenv install 3.6.10
pyenv install 3.7.6

Set global python

pyenv global 3.7.6


python --version
type -a python

Set local python

cd ~/my-project
pyenv local 3.6.10


cat .python-version
python --version
type -a python

Other languages

There's a set of similar tools for other languages, following the same convention here, so if you know pyenv, you know nodenv for example.

More resources

Hey, hello 👋

If you are interested in what I write, follow me on twitter