pyenv
Contents
pyenv#
pyenv is a command line tool that lets you easily install and switch between multiple versions of Python.
See also
Install#
# install pyenv
brew install pyenv
# display your shell
echo $SHELL
# if $SHELL is /bin/zsh
touch ~/.zshrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="~/.pyenv/bin:$PATH"\neval "$(pyenv init -)"' >> ~/.zshrc
# if $SHELL is /bin/bash
touch ~/.bash_profile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="~/.pyenv/bin:$PATH"\neval "$(pyenv init -)"' >> ~/.bash_profile
Then close your terminal and start a new one.
Quickref#
command |
description |
---|---|
|
list all available Python versions |
`pyenv install –list |
grep ‘^\s3.’` |
|
install a version of Python |
|
uninstall a version of Python |
|
list installed Python versions |
|
list the active Python version |
|
show the default Python version |
|
set the default Python version |
|
show the Python version for this directory |
|
set the Python version for this directory |
|
show the help (optionally for {command}) |