In my transition from Ruby to Python, I quickly found that there was a familiar experience that made me feel like I never left the Ruby: libraries won't work well in certain language versions.
The common solution for this problem is to find a version manager. For personal projects I have been using pipenv, which feels like an enhanced version of bundler that also handles the language version along with virtual environments. Whoa! But they are not using pyenv at work yet.
This week at work I learned to use pyenv. Pyenv is a python version manager that knows how to work along with virtualenv, python's virtual environment tool. What follows is my cheat sheet on how to use it. It is based on Logan Jones's article in Real Python [1].
Check which python versions are available
pyenv versions
Install a version of python
pyenv install 3.6.1
See what versions of python you have installed
pyenv versions
Create a virtual environment with a specific python version
pyenv virtualenv 3.3.1 chunkybacon
To manually activate and deactivate an environment
pyenv activate chunkybacon
pyenv deactivate
To see which environments you have
pyenv virtualenvs
If you want to learn how to install pyenv and go deeper on how to use it, please read the article that is the source of this cheat sheet.
References: 1. Managing Multiple Python Versions With pyenv By Logan Jones