Willy's blog

Pyenv

Description

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.

Installation

Use pyenv-installer

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

Usage

Install different python versions

pyenv install 3.6.10
pyenv install 3.7.6

Set global python

pyenv global 3.7.6

Observe

python --version
type -a python

Set local python

cd ~/my-project
pyenv local 3.6.10

Observe

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

Comments

Comments powered by Disqus