pyenv: Python Version Manager

A simple Python version manager. It is recommended to use pyenv and pipenv together.

ref:
https://github.com/yyuu/pyenv

Install

Before doing the following steps, you must install Command Line Tools.

$ brew update
$ brew install readline openssl

$ brew install pyenv
# or
$ brew upgrade pyenv
To enable shims and autocompletion add to your profile:
  if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi

$ pyenv --version
pyenv 1.2.14

ref:
https://github.com/vinta/HAL-9000/blob/master/playbooks/roles/python/files/pyenv_profile.sh

Usage

# list available Python versions
$ pyenv install -l

# install a certain version
$ pyenv install 2.7.16
$ pyenv install 3.7.4

# list installed Python versions
$ pyenv versions

# set the default Python version
$ pyenv global 3.5.1

# you can set both Python 2 and 3
$ pyenv global 3.7.4 2.7.16

# switch to the system default Python version
$ pyenv global system

# set the Python version for the current folder
# which generates `.python-version` in the same folder
$ pyenv local 3.7.4

# set the Python version for the current shell
$ pyenv shell 3.7.4

ref:
https://github.com/pyenv/pyenv/blob/master/COMMANDS.md

Sharing
  •  
  •  
  •  
  •  
  •