Watch a video tutorial about below on OsChannel.com: https://youtu.be/WVISFQpstJE
- Installation of PyEnv.
- Installation of Multiple Python versions including a macOS Fix.
- Setting Different Python versions for your Projects using multiple ways.
- Swiching between Python Versions using PyEnv.
curl https://pyenv.run | bashexport PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
eval "$(pyenv init -)"
# Once added restart your shellpyenv install --listpyenv install 3.9.1(This is for macOS users only.)
I faced an issue while installing older versions of python on my
macOS Big Sur using PyEnv and had to use this patch. Simply try
replacing the python version after the --patch flag with your
desired python version if you see below error while installing
python.

pyenv install --patch 3.7.2 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch)pyenv uninstall 3.9.1pyenv versionspyenv versionpyenv global 3.7.1python version set using pyenv local command overrides python version set using pyenv global command
pyenv local 3.8.1python version set using pyenv shell command overrides python version set using pyenv global or pyenv local command
pyenv shell 3.9.1pyenv shell --unset
pyenv local --unset
pyenv global --unsetrm -rvf ~/.pyenv
# and don't forget to remove the pyenv paths and init lines from your .bashrc/.zshrc.PyEnv has a lot more than what's stated here. We are just getting started.
For More PyEnv commands try pyenv commands and for help related to a
specific command (eg: pyenv versions) try pyenv versions --help.
I thank all the contributors of PyEnv!! For more help on PyEnv refer specific projects on below link: https://github.com/pyenv

I received a similar error while installing any python version lower than 3.8(including 3.8)
Error text:
FIX:
Simply try replacing the python version after the
--patchflag with your desired python version if you see above error while installing python.