Python Version Control

Why Do We Need This?

Sometimes you need to install different versions of Python on the same machine. For example, I need to use version 3.6.5 for serverless applications and use 3.7.4 for others.

Pyenv is a simple python version management that lets you easily switch between multiple versions of Python. It is like what nvm is to Node and rbenv is to Ruby.

Python Version Control

brew update
brew install pyenv

# Open shell script and copy/paste this line.
eval "$(pyenv init -)"

pyenv install 3.7.4

# cd dir
pyenv local 3.7.4

python3 -m venv venv

pip3 install --upgrade pip

When you run python -V in your directory, you should see Python 3.7.4 :)


Reference

pyenv

GitHubGitHubLinkedin