It enables us to use multiple python versions on the same machine without making it a mess.
Each python version can have multiple virtual environments in it
Install
curl https://pyenv.run | bash
Load
Load pyenv automatically by adding the following to ~/.bashrc:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Check available python version
pyenv install --list | grep " 3\.[678]"
Install python version
pyenv install -v py_version
Create virtual environment
pyenv virtualenv 3.8.9 py_version
Activate virtual environment
pyenv activate env_name
Set local environment for specific directory
pyenv local env_name
Useful commands
pyenv versions
ls ~/.pyenv/versions/
rm -rf ~/.pyenv/versions/2.7.15 OR pyenv uninstall 2.7.15
pip install --use-feature=2020-resolver -r pip-requirements.txt
Write a comment ...