Last active
August 26, 2023 05:58
-
-
Save yowmamasita/64d06a212c1d20238a391df350d15d11 to your computer and use it in GitHub Desktop.
Install the latest version of CPython using pyenv in a single command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# make sure you have pyenv | |
curl https://pyenv.run | bash | |
# works on ubuntu and mac | |
pyenv install $(pyenv install --list | egrep '^\s*[0-9]+\.[0-9]+\.[0-9]+$' | sort -Vr | head -n1 | tr -d '[:space:]') | |
# if you wish to use it globally | |
LATEST_PYTHON_VERSION=$(pyenv install --list | grep -v - | grep -v b | sort -Vr | head -n 1 | tr -d '[:space:]') | |
pyenv install $LATEST_PYTHON_VERSION | |
pyenv global $LATEST_PYTHON_VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment