#!/bin/bash # Save the original working directory ORIGINAL_DIR="$(pwd)" # Install pyenv (Python Version Manager) if it is not already installed if command -v pyenv &> /dev/null; then echo -e "pyenv is already installed\n" else echo -e "Installing pyenv (Python Version Manager)\n" # Using the official pyenv installer (https://github.com/pyenv/pyenv-installer) curl -fsSL https://pyenv.run | bash # Load pyenv for the remainder of this script export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init - bash)" fi # OPTIONAL: Install the latest stable version of Python # Uncomment the following line if you would like to automatically install it # pyenv install 3.12.0 && pyenv global 3.12.0 # Apply the pyenv zsh configuration patch (downloads zshrc/pyenv.zsh to ~/.config/zshrc/pyenv.zsh) curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s pyenv # Restore original working directory cd "$ORIGINAL_DIR"